Skip to content

Query scopes for role based permissions #2807

Closed Answered by drbyte
sabina1997 asked this question in Q&A
Discussion options

You must be logged in to vote

https://spatie.be/docs/laravel-permission/v6/basic-usage/basic-usage#content-scopes

$users = User::permission('edit articles')->get(); // Returns only users with the permission 'edit articles' (inherited or directly)

$usersWhoCannotEditArticles = User::withoutPermission('edit articles')->get(); // Returns all users without the permission 'edit articles' (inherited or directly)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sabina1997
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants