Redirect the user after the logout
- Published: 03 Aug 2024 Updated: 03 Aug 2024
how to redirect the user after loging out of filament app
First: create a new class with the following code:
1namespace App\Filament\Responses;
2
3use Filament\Http\Responses\Auth\Contracts\LogoutResponse as LogoutResponseContract;
4use Illuminate\Http\RedirectResponse;
5
6class LogoutResponse implements LogoutResponseContract
7{
8 public function toResponse($request): RedirectResponse
9 {
10 return redirect()->to('/');
11 }
12}
then in your appServiceProvide, import these classes:
1use App\Filament\Responses\LogoutResponse;
2use Filament\Http\Responses\Auth\Contracts\LogoutResponse as LogoutResponseContract;
and add this to the boot method:
1$this->app->singleton(
2 LogoutResponseContract::class,
3 fn ($app) => new LogoutResponse()
4);
Related Tricks:
set any page like List Or view page as the main page instead of using a dashboard page in filamentPHP
how to use a resource with multiple models
This time-saving starter kit provides a Laravel project with FilamentPHP already installed and configured, so you can dive straight into building without any of the initial setup headaches.
when you have a lot of resources, let your users search for what they looking for int he sidebar.
how to redirect the user after loging out of filament app