Support the ongoing development of Laravel.io →
Views Blade
Last updated 2 years ago.
0

Could you filter first in controller, then pass any extra info to view with a with-> ?

0

Thats not the way you want filters to work. How does a filter determine what pages a user has acces to? Maybe something in the user model? Or a service? Use that in your view.

0

That's exactly the way I use filters because the controller passes everything to view. At some point you need to decide which view to show, an admin or a regular user. The controller to me is the best place to do this. I use separate views one for admin and another for users. But look at this====https://laracasts.com/discuss/channels/general-discussion/laravel-filters-in-blade

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.