Issue
I am using Laravel 5.4 and trying to implement authentication system. I used php artisan command make:auth to setup it. I edited the views according to my layout. Now, when I am trying to logout it throwing me this error
NotFoundHttpException in RouteCollection.php line 161:
could any one help me how to logout?
Solution
In your web.php
(routes):
add:
Route::get('logout', '\App\Http\Controllers\Auth\LoginController@logout');
In your LoginController.php
add:
public function logout(Request $request) {
Auth::logout();
return redirect('/login');
}
Also, in the top of LoginController.php
, after namespace
add:
use Auth;
Now, you are able to logout using yourdomain.com/logout
URL or if you have created logout button
, add href to /logout
Answered By - Tauras
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.