vendredi 30 décembre 2016

Laravel 5.1 route not defined redirect

need to ask about error, when I tried to redirect my logout

This is UserController:

    public function logout()
{

    Auth::logout();
    return redirect()->route('auth/login');
}

This is my routes:

Route::get('/', function () {
    return view('welcome');
});
// Authentication routes...
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');

// Registration routes...
Route::get('auth/register', 'Auth\AuthController@getRegister');
Route::post('auth/register', 'Auth\AuthController@postRegister');

Route::get('testing', 'UserController@test');
Route::get('logout', 'UserController@logout');

I think, taht everything is ok on routes and I defined login properly (like a Laravel documentation)

but it still take this error:

InvalidArgumentException in UrlGenerator.php line 306:
Route [auth/login] not defined.

Can you please what is wrong? Did I make any mistake?

Thanks a lot, have a nice day!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire