Loan order only updadable on pending status
This commit is contained in:
@@ -1,5 +1 @@
|
|||||||
# Online tbbank dashboard
|
# Online tbbank dashboard
|
||||||
|
|
||||||
# Password Reset
|
|
||||||
# Status uytganden son uytgedip bilenok
|
|
||||||
# Etraplar goshmaly
|
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user