Skip to content

Commit

Permalink
added capability for additional column check on user authority table
Browse files Browse the repository at this point in the history
  • Loading branch information
vinodraut committed Oct 17, 2017
1 parent dba80bc commit 9859a39
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/YesAuthority.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,12 @@ protected function configure($requestForUserId = null, $options = [])
}

$userModel = new $userModelString;
$userFound = $userModel->findOrFail($requestForUserId);
//$userFound = $userModel->findOrFail($requestForUserId);
if(is_array($requestForUserId)) {
$userFound = $userModel->where($requestForUserId)->first();
} else {
$userFound = $userModel->where($this->configColUserId, $requestForUserId)->first();
}
$this->userIdentified = $userFound->toArray();
}

Expand All @@ -153,8 +158,14 @@ protected function configure($requestForUserId = null, $options = [])
throw new Exception('YesAuthority - User model does not exist.');
}
$userModel = new $userModelString;
$userFound = $userModel->where($this->configColUserId, Auth::id())->first();
$this->userIdentified = $userFound->toArray();
// $userFound = $userModel->where($this->configColUserId, Auth::id())->first();
if(is_array($requestForUserId)) {
$userFound = $userModel->where($requestForUserId)->first();
} else {
$userFound = $userModel->where($this->configColUserId, Auth::id())->first();
}

$this->userIdentified = $userFound->toArray();
} else {
$this->userIdentified = Auth::user()->toArray();
}
Expand Down

0 comments on commit 9859a39

Please sign in to comment.