Add actions
This commit is contained in:
@@ -13,6 +13,10 @@ class LoanOrderPolicy
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
if ($user->isOperator() && $user->cannot('viewLoanOrders')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -25,7 +29,7 @@ class LoanOrderPolicy
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($user->isOperator()) {
|
||||
if ($user->isOperator() && $user->can('viewLoanOrders')) {
|
||||
return $user->branches()->where('branches.id', $loanOrder->branch_id)->exists();
|
||||
}
|
||||
|
||||
@@ -41,6 +45,10 @@ class LoanOrderPolicy
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
if ($user->isOperator() && $user->cannot('viewLoanOrders')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -53,7 +61,7 @@ class LoanOrderPolicy
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($user->isOperator()) {
|
||||
if ($user->isOperator() && $user->can('viewLoanOrders')) {
|
||||
return $user->branches()->where('branches.id', $loanOrder->branch_id)->exists();
|
||||
}
|
||||
|
||||
@@ -75,7 +83,7 @@ class LoanOrderPolicy
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($user->isOperator()) {
|
||||
if ($user->isOperator() && $user->can('viewLoanOrders')) {
|
||||
return $user->branches()->where('branches.id', $loanOrder->branch_id)->exists();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user