Protecting Folio routes with roles and/or permissions
Hi!
I'm using Laravel Folio and Volt in resources/themes/{theme}/pages/somePage, and I’d like to restrict access to certain pages so that only users with specific roles or permissions can view them.
I believe what I really need is a way to protect the route associated with those pages. What’s the best way to handle this, if possible?
Thanks in advance!
Hey!
Yep, you should be able to do that with a middleware:
Let me know how it goes!
Putting Folio::middleware() directly inside the Blade template or mapping a prefix in FolioServiceProvider keeps role checks cleanly decoupled from theme views, so switching themes doesn't drop route guards.

