Answer the question
In order to leave comments, you need to log in
How to extend Sentinel class in Laravel 5?
There is a project on L5.2 .
It has an authorization based on the cartalyst/sentinel package .
It is necessary to expand the functionality, for example, add a simple method for checking belonging to several roles (in the original there is only the inRole($role) method , it checks only one role).
If I understood everything correctly - you can extend the User model from \Cartalyst\Sentinel\Users\EloquentUser , but it did not work and every time you get a user, the original \Cartalyst\Sentinel\Users\EloquentUser model is returned , and not, for example, App \User (this model is assigned in config/cartalyst.sentinel.php ).
How can you implement the required functionality (roughly speaking, you need a method like inRoles(array $arr) , where $arr is an array like ['admin', 'moderator'] )?
The approach with creating a helper without the Sentinel extension was not considered, because I think that this is not the right solution. If it's not, please correct it.
Thank you.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question