add types
This commit is contained in:
1 parent
88b934bda1
commit
e5907fe3a9
46 files changed
+465
-184
No files matched your search
@@ -2,8 +2,9 @@
|
||||
|
||||
namespace App\Policies\Order\Card;
|
||||
|
||||
use App\Models\CardOrder;
|
||||
use App\Models\Order\Card\CardOrder;
|
||||
use App\Models\User;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
|
||||
class CardOrderPolicy
|
||||
{
|
||||
@@ -29,10 +30,10 @@ public function view(User $user, CardOrder $cardOrder): bool
|
||||
}
|
||||
|
||||
if ($user->isOperator() && $user->can('viewCardOrders')) {
|
||||
return $user->branches()->where('branches.id', $loanOrder->branch_id)->exists();
|
||||
return $user->branches()->where('branches.id', $cardOrder->branch_id)->exists();
|
||||
}
|
||||
|
||||
if ($user->ownsLoanOrder($loanOrder)) {
|
||||
if ($user->ownsCardOrder($cardOrder)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -61,10 +62,10 @@ public function update(User $user, CardOrder $cardOrder): bool
|
||||
}
|
||||
|
||||
if ($user->isOperator() && $user->can('viewCardOrders')) {
|
||||
return $user->branches()->where('branches.id', $loanOrder->branch_id)->exists();
|
||||
return $user->branches()->where('branches.id', $cardOrder->branch_id)->exists();
|
||||
}
|
||||
|
||||
if ($user->ownsLoanOrder($loanOrder) && in_array($loanOrder->status, [
|
||||
if ($user->ownsCardOrder($cardOrder) && in_array($cardOrder->status, [
|
||||
OrderRepo::PENDING,
|
||||
])) {
|
||||
return true;
|
||||
@@ -83,10 +84,10 @@ public function delete(User $user, CardOrder $cardOrder): bool
|
||||
}
|
||||
|
||||
if ($user->isOperator() && $user->can('viewLoanOrders')) {
|
||||
return $user->branches()->where('branches.id', $loanOrder->branch_id)->exists();
|
||||
return $user->branches()->where('branches.id', $cardOrder->branch_id)->exists();
|
||||
}
|
||||
|
||||
if ($user->ownsLoanOrder($loanOrder)) {
|
||||
if ($user->ownsCardOrder($cardOrder)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user