Combination of authenticated/unauthenticated routes in a panel
G'day
Just wondering if filamentv3 has a way to allow a panel to have some pages that require authentication, and some that don't.
I've seen in the docs you can remove auth from a panel completely, but I am wanting to have some pages where authentication is required. If that page is visited and there is no logged in user, it should redirect them to login.
I've tried using
canAccess
method on the page, which kinda works as it gives a 403
response, but I was hoping to be able to redirect to login instead.Solution:Jump to solution
I think I figured it out actually. Just need to add the
Authenticate
route to a $routeMiddleware
property on the page.
And then in the canAccess
return false if there is no user to hide the page from menus for no logged in users
```php...1 Reply
Solution
I think I figured it out actually. Just need to add the
Authenticate
route to a $routeMiddleware
property on the page.
And then in the canAccess
return false if there is no user to hide the page from menus for no logged in users