I would like to access a column called "access_level" in table "roles". The thing now is that I wanted to avoid middlewares as it needs to be executed (checked) on every page load, what implies passing the same middleware to every route. Now I could query it and passing it to every route which is somehow same as passing the same middleware. In order to avoid that passing and exclude logic from blade, I was thinking to extend the Auth Facade simply with a method that returns the access level. From that point I can just say @if (Auth::getAccessLevel > 3) ... @endif.
Now I want your opinion on this, how good approach is this? I wanna be able to show certain parts of the website according to the user's access level.
Iff it is a good approach, why my method implemented in GuardHelpers.php isn't visible? Most of the Auth methods are implemented there.
Thanks!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community