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:
@ -73,6 +73,17 @@ class User extends Authenticatable implements WebAuthnAuthenticatable
|
|||||||
'twofaccounts_count' => 'integer',
|
'twofaccounts_count' => 'integer',
|
||||||
'groups_count' => 'integer',
|
'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.
|
* Send the password reset notification.
|
||||||
|
Reference in New Issue
Block a user