We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi.
Have you planned to add a method to filter users by role ?
e.g. : User::role('admin')->get() or User::role('guest')->get()
The text was updated successfully, but these errors were encountered:
cool. 👍
But I think it should have a nicer name, like User::whereRole('admin') or whereRoles(['admin', 'employ']).
Proposal:
1 - whereRoles, whereRole 2 - whichRole, whichRoles 3 - rolesAre(), roleIs()
Sorry, something went wrong.
Actually what I did is a simple scope :
public function scopeRole($query, $role) { return $this->whereHas('roles', function($query) use($role){ $query->where('name', $role); }); }
whichRoles scope
7785c68
``` User::WhichRoles(‘admin’)->get(); User::WhichRoles([‘admin’, ‘agent’])->get(); ``` Issue #47
Need apply tests
vluzrmos
No branches or pull requests
Hi.
Have you planned to add a method to filter users by role ?
e.g. : User::role('admin')->get() or User::role('guest')->get()
The text was updated successfully, but these errors were encountered: