I am trying to override default logout button in my Laravel project. so I defined below code in my LoginController->logout() function. but it’s showing that my guard is not defined. so i googled a lot then I reached a solution of it. let’s see what i found on this.
Auth::guard('user')->logout();
Just changes below codes in your config/auth.php file. and by the way I am using old Laravel version i.e. 5.5
'guards' => [ | |
'web' => [ | |
'driver' => 'session', | |
'provider' => 'users', | |
], | |
'api' => [ | |
'driver' => 'token', | |
'provider' => 'users', | |
], | |
// // define your Auth here | |
'your_auth_name' => [ | |
'driver' => 'session', | |
'provider' => 'your table name', | |
], | |
], |
After changes in your guards section change in ‘providers‘ section also of your auth.php
'providers' => [ | |
'users' => [ | |
'driver' => 'eloquent', | |
'model' => App\User::class, | |
], | |
// 'users' => [ | |
// 'driver' => 'database', | |
// 'table' => 'users', | |
// ], | |
// add provider to your auth | |
'table name' => [ | |
'driver' => 'eloquent', | |
'model' => App\User::class, | |
], |
if your problem occurs yet then please run below commands to clear your cache
php artisan config:clear
php artisan config:cache
If you have any confusion on this issue then feel free to comment and if you find more issue in your L:aravel projects then comment for more resolution. i will be delighted on solving your issues.
References :



MotoShare.in provides the perfect two-wheeler for every occasion—daily commuting, weekend escapes, tourist exploration, or test-riding your dream bike. Simplify your mobility with us!