Filament Register Redirect

I currently have a custom registration page where users are automatically logged in but directed to the wrong panel. Can we redirect them to the correct panel (/customer)?
Solution:
Return the register response: ```php <?php ...
Jump to solution
5 Replies
BlackShadow
BlackShadowOP5mo ago
Redirects to /admin which results in a forbidden page. But i want them redirected to /customers (tenancy).
Vp
Vp5mo ago
Maybe you can have some ideas from this video https://www.youtube.com/watch?v=9hRgCjDQDGw
Filament Daily
YouTube
Filament Roles: Single vs Multiple Panels Example
A 2-in-1 example of implementing roles: in the same panel or in separate panels? Also, building a common login form or not? - Source for single panel: https://filamentexamples.com/project/filament-roles-in-sign-up-and-different-resources - Source for multiple panels: https://filamentexamples.com/project/filament-roles-with-multiple-panels - Ori...
krekas
krekas5mo ago
redirect using register response
BlackShadow
BlackShadowOP5mo ago
Thanks! I will take a look.
Solution
BlackShadow
BlackShadow5mo ago
Return the register response:
<?php

namespace App\Http\Responses;

use Filament\Http\Responses\Auth\RegistrationResponse;
use Illuminate\Http\RedirectResponse;
use Livewire\Features\SupportRedirects\Redirector;

class CustomerRegisterResponse extends RegistrationResponse
{
public function toResponse($request): RedirectResponse|Redirector
{
return redirect()->route(''); // Replace with the route you want to redirect to.
}
}
<?php

namespace App\Http\Responses;

use Filament\Http\Responses\Auth\RegistrationResponse;
use Illuminate\Http\RedirectResponse;
use Livewire\Features\SupportRedirects\Redirector;

class CustomerRegisterResponse extends RegistrationResponse
{
public function toResponse($request): RedirectResponse|Redirector
{
return redirect()->route(''); // Replace with the route you want to redirect to.
}
}
Want results from more Discord servers?
Add your server