How to Auth Logout in Laravel 5
In this tutorial, we are going to cover the authentication logout system in the Laravel 5 framework. Auth::logout() function to destroy all authentication information so find out below code.
Steps For How to Auth Logout in Laravel 5
Step 1. Create route
We are required only one route to call controller.
Route::get('logout', [
'as' => 'logout',
'uses' => 'SigninController@Logoutuser'
]);
Step 2. SigninController with Logoutuser function
We will first need to import the Auth namespace.
use Illuminate\Support\Facades\Auth;
In this step authentication destroy.
public function Logoutuser()
{
Auth::logout();
return redirect('login');
}
And if you like this tutorials please share it with your friends via Email or Social Media.
Leave a Reply