Loan order only updadable on pending status

This commit is contained in:
2023-12-03 18:39:17 +05:00
parent 236ebe57b5
commit 8eb11b0183
2 changed files with 4 additions and 5 deletions

View File

@@ -1,5 +1 @@
# Online tbbank dashboard # Online tbbank dashboard
# Password Reset
# Status uytganden son uytgedip bilenok
# Etraplar goshmaly

View File

@@ -4,6 +4,7 @@ namespace App\Policies\Order\Loan;
use App\Models\Order\Loan\LoanOrder; use App\Models\Order\Loan\LoanOrder;
use App\Models\User; use App\Models\User;
use App\Repos\Order\OrderRepo;
class LoanOrderPolicy class LoanOrderPolicy
{ {
@@ -56,7 +57,9 @@ class LoanOrderPolicy
return $user->branches()->where('id', $loanOrder->branch_id)->exists(); 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; return true;
} }