//make a route as a post
Route::post("/logout",[LogoutController::class,"store"])->name("logout");
//and make a form in your template or what ever you frontend client..
<form action="{{ route('logout') }}" method="post">
@csrf
<button type="submit">Logout</button>
</form>
//Controller will be like this.
public function store(Request $request) {
auth()->logout();
return redirect()->route('login');
}
//route
Route::get('logout',[AuthController::class, 'logout'])->name('logout');
//logout function
use Auth,Session;
public function logout(){
Auth::logout();
Session::flush();
return redirect()->route('login');
}
<a href="{{ route('admin_logout') }}">Log Out </a>
#route
Route::get('logout', 'AppHttpControllersAuthLoginController@logout');
#controller
use Auth;
public function logout(Request $request) {
Auth::logout();
return redirect('/login');
}
#
if (Auth::once($credentials)) {
//
}