public function getByRoles(array $rolesIds) { return $this->model->whereHas('roles', function ($query) use($rolesIds) { $query->whereIn('id', $rolesIds); })->get(); }