I'm working on my first laravel project in which I made an admin panel to make admin able to controller the website. I tried to login admin into dashboard and everything was fine, when I tried to log him out nothing works and the page was just reloading and redirect back.
Here is my logout button:
<a class="navbar-brand btn btn-primary btn-lg"
href="{{route('admin.logout'))}}"> log out</a>
My route:
Route::get('logout', 'LoginController@logout')->name('admin.logout');
And my controller:
use Illuminate\support\Facades\Auth;
public function logout(Request $request){
Auth::logout();
return redirect()->route('get.admin.login')
->with(['success'=>'logged out successfully']);
}
I used Auth::logout(); method from laravel official documentation, however it didn't work.
I hope I can find help.