Is is calling an action in the vendor folder?
Feb 24, 2025
5
Level 20
How is the Laravel 12 starter kit doing this?
I was playing around the new Laravel 12 starter kits and found this Logout livewire action.
I tried to do this in my existing livewire 3 project and the route doesn't even get registered. So clicking submit gives you 404.
How does this work in the starter kit?
// routes/auth.php
Route::post('logout', App\Livewire\Actions\Logout::class)
->name('logout');
// app/Livewire/Actions/Logout.php
namespace App\Livewire\Actions;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;
class Logout
{
public function __invoke()
{
Auth::guard('web')->logout();
Session::invalidate();
Session::regenerateToken();
return redirect('/');
}
}
<form method="POST" action="{{ route('logout') }}" class="w-full">
@csrf
<flux:menu.item as="button" type="submit">
Logout
</flux:menu.item>
</form>
Please or to participate in this conversation.