src/Database/Queries/Roles.php
public function constrainWhereIsAll($query, $role)
    {
        $roles = array_slice(func_get_args(), 1);

        return $query->whereHas('roles', function ($query) use ($roles) {
            $query->whereIn('name', $roles);
        }, '=', count($roles));
    }
public function constrainWhereIsAll($query, $role)
    {
        $roles = array_slice(func_get_args(), 1);

        return $query->whereHas('roles', function ($query) use ($roles) {
            $query->whereIn('name', $roles);
        }, '=', count($roles));
    }
public function constrainWhereIsAll ( $ query , $ role ) { $ roles = array_slice ( func_get_args ( ) , 1 ) ; return $ query -> whereHas ( 'roles' , function ( $ query ) use ( $ roles ) { $ query -> whereIn ( 'name' , $ roles ) ; } , '=' , count ( $ roles ) ) ; }
Constrain the given query by all provided roles.

@param  \Illuminate\Database\Eloquent\Builder  $query
@param  string  $role
@return \Illuminate\Database\Eloquent\Builder
Constrain the given query by all provided roles .