0
votes

I'm new to laravel 5.4 and these days I am building a blog site.. followings are my authentication routes,

Route::get('auth/login','Auth\LoginController@showLoginForm');
Route::post('auth/login','Auth\LoginController@login');
Route::get('auth/logout','Auth\LoginController@logout');
Route::post('login','Auth\LoginController@login');

Route::get('auth/register','Auth\RegisterController@showRegistrationForm');
Route::post('auth/register','Auth\RegisterController@register');""



I locked my post controller from un authenticated user, using auth midlleware, so i want to redirect the unauthenticated users to login page for authentication but when an unauthenticated user try to access post controller following exception occured

InvalidArgumentException Route [login] not defined

my login route is auth/login

so how I find the place to change the redirect url "login" to "auth/login"

1

1 Answers

1
votes

Laravel doesn't look for a route with the url "login", it looks for a route where the name is "login". You could give your auth/login route the name login.

Route::post('auth/login','Auth\LoginController@login')->name('login');