mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-30 12:40:04 +02:00
Add an Admin scope to retrieve Admin users easily
This commit is contained in:
@ -74,6 +74,17 @@ class User extends Authenticatable implements WebAuthnAuthenticatable
|
||||
'groups_count' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* Scope a query to only include admin users.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder<User> $query
|
||||
* @return \Illuminate\Database\Eloquent\Builder<User>
|
||||
*/
|
||||
public function scopeAdmins($query)
|
||||
{
|
||||
return $query->where('is_admin', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the password reset notification.
|
||||
*
|
||||
|
Reference in New Issue
Block a user