Skip to content

Commit

Permalink
Fix table builder
Browse files Browse the repository at this point in the history
  • Loading branch information
curtisdelicata committed Oct 5, 2020
1 parent 82ad27f commit ac38109
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/Tables/Builders/UserTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function query(): Builder

$auth = Auth::user();

if ($user->isAdmin() || $user->isSupervisor()) {
if ($auth->isAdmin() || $auth->isSupervisor()) {


return User::with('person:id,appellative,name', 'avatar:id,user_id')
Expand All @@ -29,24 +29,20 @@ public function query(): Builder
')->join('people', 'users.person_id', '=', 'people.id')
->join('user_groups', 'users.group_id', '=', 'user_groups.id')
->join('roles', 'users.role_id', '=', 'roles.id');
}

}

else {
} else {
return User::where('id', $auth->id)
->with('person:id,appellative,name', 'avatar:id,user_id')
->selectRaw('
->with('person:id,appellative,name', 'avatar:id,user_id')
->selectRaw('
users.id, user_groups.name as "group", people.name, people.appellative,
people.phone, users.email, roles.name as role, users.is_active,
users.created_at, users.person_id
')->join('people', 'users.person_id', '=', 'people.id')
->join('user_groups', 'users.group_id', '=', 'user_groups.id')
->join('roles', 'users.role_id', '=', 'roles.id');
}
}
}


}

public function templatePath(): string
{
Expand Down

0 comments on commit ac38109

Please sign in to comment.