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...