Loan order only updadable on pending status

This commit is contained in:
nurmuhammet committed 2023-12-03 18:39:17 +05:00
1 parent 236ebe57b5
commit 8eb11b0183
2 files changed
+4 -5

No files matched your search

+4 -1
View File
@@ -4,6 +4,7 @@
use App\Models\Order\Loan\LoanOrder;
use App\Models\User;
use App\Repos\Order\OrderRepo;
class LoanOrderPolicy
{
@@ -56,7 +57,9 @@ public function update(User $user, LoanOrder $loanOrder): bool
return $user->branches()->where('id', $loanOrder->branch_id)->exists();
}
if ($user->ownsLoanOrder($loanOrder)) {
if ($user->ownsLoanOrder($loanOrder) && in_array($loanOrder->status, [
OrderRepo::PENDING,
])) {
return true;
}