You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my current situation, I would like to use the https://github.com/spatie/laravel-enum/ package for managing the names of the roles used in my application for easier refactoring, user-facing role labels, general IDE benefits, etc.
However, for all the methods provided by the HasRoles trait or the Role class (as an example), I either have to do something like
or I have to override the method and make a call to the parent method using the above technique.
This approach would be much easier if there was an interface which is included as these public methods' parameter type, to resolve the Role name (a single method returning a string would suffice) from an implementing class (or native php Enum once 8.1 comes around).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In my current situation, I would like to use the https://github.com/spatie/laravel-enum/ package for managing the names of the roles used in my application for easier refactoring, user-facing role labels, general IDE benefits, etc.
However, for all the methods provided by the
HasRoles
trait or theRole
class (as an example), I either have to do something likeor I have to override the method and make a call to the parent method using the above technique.
This approach would be much easier if there was an interface which is included as these public methods' parameter type, to resolve the Role name (a single method returning a string would suffice) from an implementing class (or native php Enum once 8.1 comes around).
Beta Was this translation helpful? Give feedback.
All reactions