Hello, I have a problem with the Login routing with the php artisan make:auth method that generates everything you need. Since we are going it cost me a lot to join the project that I was doing to this login and its views. But it won't let me change the default route to one I want
This is how they come by default:
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
Route::post('login', 'Auth\LoginController@login');
Route::post('logout', 'Auth\LoginController@logout');
This is how I customize
Route::get('admin/auth/login', 'Auth\LoginController@showLoginForm')->name('login');
Route::post('admin/auth/login', 'Auth\LoginController@login');
Route::post('admin/auth/logout', 'Auth\LoginController@logout');
LoginController.php
use AuthenticatesUsers;
protected $redirectTo = '/';
public function __construct()
{
$this->middleware('guest', ['except' => 'logout']);
}
public function showLoginForm()
{
return view('admin.auth.login'); //tambien cambie de dir la carp auth
}
public function logout(Request $request)
{
$this->guard()->logout();
$request->session()->flush();
$request->session()->regenerate();
//return view('inicio');
return redirect('/');
}
When I enter the login route, and I log in, it throws me this error:
NotFoundHttpException in RouteCollection.php line 161:...
Indeed, I failed to correct the form
login.blade.php
by the default provided by Laravel. By putting the correct URL it works as expected.Remember, that there is also the Logout form where the same thing happens.