JosephSilber / bouncer

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

Is it possible to keep all abilities hardcoded instead of abilities table #649

Closed aravael closed 3 months ago

aravael commented 3 months ago

I'd like to move all my abilities from a database to the code, is that really possible? Just want to know your opinion since per my check it's not easy to do. @JosephSilber

The idea is to have a class with all the abilities and extend the array of abilities when needed. Since an ability is checked directly in the code when added, it will not have an affect if it's not added to the table. That's why I want to know whether it's even possible to implement.

JosephSilber commented 3 months ago

If you keep everything in code, you don't even need Bouncer. Laravel's Policies is all you need.

If you mean that you want abilities in code, but roles in the DB... Then no, that's not how Bouncer works.