get user with role laravel
snippet in php

get user with role laravel

user5652

$students = User::whereHas(
    'roles', function($q){
        $q->where('name', 'Teacher');
    }
)->get();