How do I redirect a user after login based on the panel they are allowed to view?
I have 2 panels:
I want to say, if you can view the Cp then redirect there, else redirect to the frontend. I have this in
app/Http/Responses/LoginResponse.php
Solution:Jump to solution
Gone with this, which is okay at the moment:
```php return Auth::user()->canAccessPanel(Filament::getPanel('cp')) ? redirect()->intended(route('filament.cp.pages.dashboard')) : redirect()->intended(route('home'));...
```php return Auth::user()->canAccessPanel(Filament::getPanel('cp')) ? redirect()->intended(route('filament.cp.pages.dashboard')) : redirect()->intended(route('home'));...
4 Replies
Solution
Gone with this, which is okay at the moment:
@johncarter how did you implement the response into a panel?
Wouldn’t this be better in a middleware?
I ended up moving the navigation item to the page header as that was causing it to redirect to an unintended location. Seemed like the simpler change 🤷♂️