<!DOCTYPE html>
Let’s learn Laravel 11 with Inertia Js and Vue Js in 2024
Welcome to our tutorial series where we will be learning how to use Laravel 11 with Inertia Js and Vue Js. In this tutorial, we will be focusing on creating a logout functionality without using a starter kit.
Logout functionality
In order to create a logout functionality, we will need to add a route and a controller method in our Laravel application.
Step 1: Add a route
Open your routes/web.php file and add the following route:
“`php
Route::get(‘/logout’, ‘AuthController@logout’)->name(‘logout’);
“`
Step 2: Create a controller method
Create a new controller file called AuthController.php in your app/Http/Controllers directory and add the following code:
“`php
use IlluminateSupportFacadesAuth;
public function logout()
{
Auth::logout();
return redirect(‘/’);
}
“`
Step 3: Create a logout link
In your Vue component or Inertia page, add a link to the logout route:
“`html
Logout
“`
That’s it! You have now successfully added a logout functionality to your Laravel application without using a starter kit.
Stay tuned for more tutorials on Laravel 11 with Inertia Js and Vue Js.
Hi, can u tell me what's font do you use ? Thanks for ur answer 🙂
Bro, best content on internet for fresher..! Can you please create a video tutorial on how to upload images? It would be really helpful.