JosephSilber / bouncer

Laravel Eloquent roles and abilities.
MIT License
3.43k stars 330 forks source link

Get Direct Abilities - Not via Roles #630

Closed Aniket-IN closed 1 year ago

Aniket-IN commented 1 year ago

Hi 👋,

I was just getting started with this pacakge, needed a small help. I'm trying to get direct abilities of a user, saw there'a method $user->getAbilities() but, this method includes abilities assigned via roles as well 🤔. How do I get only abilities those are directly assigned to the user and not via roles.

Thank you 😊.

JosephSilber commented 1 year ago

You can get those via the regular abilities Eloquent relationship:

$user->abilities
Aniket-IN commented 1 year ago

Exactly what I neded. Thank you so much for the amazing package. 😃