Skip to main content

Logout and Link with POST Method

Premium
2 min read

In this lesson, let's work on the logout functionality. I will show you how to use Inertia to make a link, but with post method.


To perform the logout, first on the back-end, let's create the route.

routes/web.php:

Route::view('/', 'dashboard')->name('dashboard');
 
Route::middleware('auth')->group(function () {
Route::resource('posts', PostController::class);
Route::inertia('about', 'About')->name('about');
});
Route::inertia('login', 'Auth/Login')->name('login');
Route::post('login', [\App\Http\Controllers\Auth\LoginController::class, 'store'])->name('login.post');
Route::post('logout', [\App\Http\Controllers\Auth\LoginController::class, 'destroy'])->name('logout');

In the Controller, we will use...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (30 h 09 min)

You also get:

55 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

No comments yet…

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.