Loan order only updadable on pending status
This commit is contained in:
1 parent
236ebe57b5
commit
8eb11b0183
2 files changed
+4
-5
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user