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?
This method requires the user to provide their current password, which your application should accept through an input form: use Illuminate\Support\Facades\Auth; Auth::logoutOtherDevices(request('password')); When the logoutOtherDevices method is invoked, the user's other sessions will be invalidated entirely, meaning ...
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With