Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $users = User::byRole()->inCompany()
- ->with([
- 'role' => function ($q) use ($orderBy, $relationship, $asc) {
- $q->select('id', 'title')->orderBy('title','DESC');
- },
- 'company' => function ($q) {
- $q->select('id', 'company_name');
- },
- 'projects' => function ($q) {
- $q->select('id', 'name');
- },
- ])->select([
- 'email',
- 'id',
- 'company_id',
- ])->paginate();
Add Comment
Please, Sign In to add comment