From ac38109bd4350250e81897e90674b7130d4c2cf4 Mon Sep 17 00:00:00 2001 From: Curtis Delicata Date: Mon, 5 Oct 2020 20:35:09 +0100 Subject: [PATCH] Fix table builder --- src/Tables/Builders/UserTable.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/Tables/Builders/UserTable.php b/src/Tables/Builders/UserTable.php index 61fc00f6..5b662f6e 100644 --- a/src/Tables/Builders/UserTable.php +++ b/src/Tables/Builders/UserTable.php @@ -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') @@ -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 {