Answers for "laravel logout route"

PHP
3

laravel logout

//make a route as a post and button should look like this
 <form action="{{ route('logout') }}" method="post">
       @csrf
       <button type="submit">Logout</button>
</form>
//Controller will be like this.
public function store(){
        auth()->logout();
        return redirect()->route('home');
    }
Posted by: Guest on September-04-2021
1

logout in laravel 8

#route
Route::get('logout', '\App\Http\Controllers\Auth\LoginController@logout');

#controller
use Auth;
public function logout(Request $request) {
  Auth::logout();
  return redirect('/login');
}

#
Posted by: Guest on October-22-2021
1

laravel auth

composer require laravel/ui

php artisan ui vue --auth

npm install && npm run dev
Posted by: Guest on December-22-2020
0

logout in laravel

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

/**
 * Log the user out of the application.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return \Illuminate\Http\Response
 */
public function logout(Request $request)
{
    Auth::logout();

    $request->session()->invalidate();

    $request->session()->regenerateToken();

    return redirect('/');
}
Posted by: Guest on September-13-2021
-2

laravel 8 make:auth

composer require laravel/ui --dev
php artisan ui vue --auth
Posted by: Guest on December-22-2020
4

laravel auth

//namespace
use Illuminate\Support\Facades\Auth;
Posted by: Guest on May-17-2020

Browse Popular Code Answers by Language