Bladephp: Now with 7+ codeigniter, php, and laravel project 7+ php project From $18/Year From Rs. 1000/Year

How to Auth Logout in Laravel 5

by
Category:laravel
mysql laravel
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. You may also like How to Create Authentication Login in Laravel 5 and Shopping Cart using Laravel 5.

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.


0 Comments


Html code work in comment box


Related Post