F
Filament5mo ago
Wim

Redirect to app panel instead of admin panel

I have an admin panel and an app panel. The default() is added on the admin panel. Each time I try to login a user (after invitation email) using auth()->login($user); it would redirect to the admin panel. Is there a way I can 'force' to go to the app panel?
4 Replies
LeandroFerreira
LeandroFerreira5mo ago
How are you inviting users?
Wim
WimOP5mo ago
Like this one: https://www.youtube.com/watch?v=YpK16Z6Hr14&t=85s In fact, when the invite user action I create an invitation entry in a table. Then the invited user clicks on the link in the mail and the following is executed public function create(): void {
$this->invitationModel = Invitation::find($this->invitation); $user = User::create([ 'name' => $this->form->getState()['name'], 'email' => $this->invitationModel->email, 'password' =>Hash::make($this->form->getState()['password']), ]); $user->organizations()->attach($this->invitationModel->organization_id); auth()->login($user); //this one goes to admin panel because it's default() but I need it to go to app (user) panel $this->redirect(Dashboard::getUrl()); }
Dennis Koch
Dennis Koch5mo ago
Shouldn't there be a redirect anywhere? I don't think auth()->login() will redirect you
Wim
WimOP4mo ago
Correct, there is a $this->redirect(Dashboard::getURL()). But as said, that redirects to the Admin panel (as it's the default()). What I would like is that it redirects to the App panel. I have 'fixed' it as follows: if (Filament::getPanel()->getId() === 'admin') { Filament::getPanel('app')->auth()->login($user); $this->redirect(route('filament.app.resources.products.index', ['tenant' => $this->invitationModel->organization_id])); session()->regenerate(); } But this does not feel correct and efficient.
Want results from more Discord servers?
Add your server