Redirect customer to home page after they login or logout
I have three panels in my app: Admin, Vendor and Customer(default). All three panels use filament's authentication features. In the customer's panel provider, I have added the path to be empty:
$panel->path(' ')
. I want when a customer logs in to the system through Filament's login page, they should be redirected to the homepage and not the panel's dashboard. The customers can still visit the filament dashboard through the /dashboard
. How can I achieve this functionality? Has anyone tried something similar before?Solution:Jump to solution
<?php
namespace App\Filament;
use Filament\Http\Responses\Auth\Contracts\LogoutResponse as Responsable;...
7 Replies
I've found this and solved it !!
GitHub
Redirect of the logout to home page Β· filamentphp filament Β· Discus...
Please, how do I redirect my logout to home page of my front end? I currently, if I log out from admin dashboard, it redirect me to login page of the filament admin login. I want a way to redirect ...
crear app\Filament\MyLogoutResponse.php
Solution
<?php
namespace App\Filament;
use Filament\Http\Responses\Auth\Contracts\LogoutResponse as Responsable;
use Illuminate\Http\RedirectResponse;
class MyLogoutResponse implements Responsable
{
public function toResponse($request): RedirectResponse
{
return redirect()->to(
route('home'), // put the name of your home route here
);
}
}
Worked like a charm. Thank you π
Mark answer as solved π