The command:
php artisan route:list
shows:
GET|HEAD | / | App\Http\Controllers\StaticController@index
I added following code in my StaticController controller
public function logout(Request $request)
{
Auth::logout();
$request->session()->flush();
return Redirect::route('/');
}
In my web.php:
Route::get('/', 'StaticController@index');
Route::group(['middleware' => ['web', 'auth']], function () {
Route::get('/logout', 'MiscController@logout');
});
When I click on logout link, it shows the message:
InvalidArgumentException in UrlGenerator.php line 304:
Route [/] not defined.
When I reload the page showing error, it redirects me to: /login Not able to figure out what's wrong here.