YouTube Icon

Code Playground.

How to Auth Logout in Laravel 5

CFG

How to Auth Logout in Laravel 5

In this guide, we're going to cover the Laravel 5 application authentication logout feature. Auth::logout() function removes all information about authentication so check out the code below. 

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.




CFG