fix permission bug

This commit is contained in:
nurmuhammet committed 2023-12-04 15:11:04 +05:00
1 parent 69be5f2461
commit cd071f7c75
4 files changed
+10 -10

No files matched your search

+3 -3
View File
@@ -26,7 +26,7 @@ public function view(User $user, LoanOrder $loanOrder): bool
}
if ($user->isOperator()) {
return $user->branches()->where('id', $loanOrder->branch_id)->exists();
return $user->branches()->where('branches.id', $loanOrder->branch_id)->exists();
}
if ($user->ownsLoanOrder($loanOrder)) {
@@ -54,7 +54,7 @@ public function update(User $user, LoanOrder $loanOrder): bool
}
if ($user->isOperator()) {
return $user->branches()->where('id', $loanOrder->branch_id)->exists();
return $user->branches()->where('branches.id', $loanOrder->branch_id)->exists();
}
if ($user->ownsLoanOrder($loanOrder) && in_array($loanOrder->status, [
@@ -76,7 +76,7 @@ public function delete(User $user, LoanOrder $loanOrder): bool
}
if ($user->isOperator()) {
return $user->branches()->where('id', $loanOrder->branch_id)->exists();
return $user->branches()->where('branches.id', $loanOrder->branch_id)->exists();
}
if ($user->ownsLoanOrder($loanOrder)) {