In this tutorial we’re going to learn how to use custom user logout function in laravel this tutorial will help you for custom user logout system.
Got to web.php and put below code.
Route::get('/user/logout', [BrandController::class, 'Logout'])->name('user.logout')->name('user.logout');
Just got to your controller function and put below code
public function Logout(Request $request)
{
auth('web')->logout();
return redirect()->route('login')->with('logout', 'Logged out successfully');
}
Next go to view page and put this code
<a href="{{ route('user.logout')}}"> <i class="mdi mdi-logout"></i> Log Out </a>
Output:-