how to get user with has role in laravel 8 code example
Example: get user with role laravel
$students = User::whereHas(
'roles', function($q){
$q->where('name', 'Teacher');
}
)->get();
$students = User::whereHas(
'roles', function($q){
$q->where('name', 'Teacher');
}
)->get();