send notification
This commit is contained in:
@@ -13,8 +13,8 @@ class LoanOrderPolicy
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
if ($user->isOperator() && $user->cannot('viewLoanOrders')) {
|
||||
return false;
|
||||
if ($user->isOperator()) {
|
||||
return $user->getPermissionNames()->contains('ViewLoanOrders');
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -29,8 +29,11 @@ class LoanOrderPolicy
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($user->isOperator() && $user->can('viewLoanOrders')) {
|
||||
return $user->branches()->where('branches.id', $loanOrder->branch_id)->exists();
|
||||
if ($user->isOperator() && $user->getPermissionNames()->contains('ViewLoanOrders')) {
|
||||
return in_array(
|
||||
$loanOrder->branch_id,
|
||||
$user->branches->pluck('id')->toArray()
|
||||
);
|
||||
}
|
||||
|
||||
if ($user->ownsLoanOrder($loanOrder)) {
|
||||
@@ -45,8 +48,8 @@ class LoanOrderPolicy
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
if ($user->isOperator() && $user->cannot('viewLoanOrders')) {
|
||||
return false;
|
||||
if ($user->isOperator()) {
|
||||
return $user->getPermissionNames()->contains('ViewLoanOrders');
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -61,8 +64,11 @@ class LoanOrderPolicy
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($user->isOperator() && $user->can('viewLoanOrders')) {
|
||||
return $user->branches()->where('branches.id', $loanOrder->branch_id)->exists();
|
||||
if ($user->isOperator() && $user->getPermissionNames()->contains('ViewLoanOrders')) {
|
||||
return in_array(
|
||||
$loanOrder->branch_id,
|
||||
$user->branches->pluck('id')->toArray()
|
||||
);
|
||||
}
|
||||
|
||||
if ($user->ownsLoanOrder($loanOrder) && in_array($loanOrder->status, [
|
||||
@@ -83,8 +89,11 @@ class LoanOrderPolicy
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($user->isOperator() && $user->can('viewLoanOrders')) {
|
||||
return $user->branches()->where('branches.id', $loanOrder->branch_id)->exists();
|
||||
if ($user->isOperator() && $user->getPermissionNames()->contains('ViewLoanOrders')) {
|
||||
return in_array(
|
||||
$loanOrder->branch_id,
|
||||
$user->branches->pluck('id')->toArray()
|
||||
);
|
||||
}
|
||||
|
||||
if ($user->ownsLoanOrder($loanOrder)) {
|
||||
|
||||
Reference in New Issue
Block a user