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::post('logout', [\App\Http\Controllers\Auth\LoginController::class, 'destroy'])->name('logout');
});
Route::inertia('login', 'Auth/Login')->name('login');
Route::post('login', [\App\Http\Controllers\Auth\LoginController::class, 'store'])->name('login.post');

In the Controller, we will use...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (31 h 16 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…