wip
This commit is contained in:
11
app/Models/Order/Card/CardTransaction/CardTransaction.php
Normal file
11
app/Models/Order/Card/CardTransaction/CardTransaction.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Order\Card\CardTransaction;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CardTransaction extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
@@ -13,9 +13,9 @@ class LoanOrderPolicy
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
if ($user->isOperator()) {
|
||||
return $user->getPermissionNames()->contains('ViewLoanOrders');
|
||||
}
|
||||
// if ($user->isOperator()) {
|
||||
// return $user->getPermissionNames()->contains('ViewLoanOrders');
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -29,13 +29,17 @@ class LoanOrderPolicy
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($user->isOperator() && $user->getPermissionNames()->contains('ViewLoanOrders')) {
|
||||
return in_array(
|
||||
$loanOrder->branch_id,
|
||||
$user->branches->pluck('id')->toArray()
|
||||
);
|
||||
if ($user->isOperator()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// if ($user->isOperator() && $user->getPermissionNames()->contains('ViewLoanOrders')) {
|
||||
// return in_array(
|
||||
// $loanOrder->branch_id,
|
||||
// $user->branches->pluck('id')->toArray()
|
||||
// );
|
||||
// }
|
||||
|
||||
if ($user->ownsLoanOrder($loanOrder)) {
|
||||
return true;
|
||||
}
|
||||
@@ -48,8 +52,12 @@ class LoanOrderPolicy
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
// if ($user->isOperator()) {
|
||||
// return $user->getPermissionNames()->contains('ViewLoanOrders');
|
||||
// }
|
||||
|
||||
if ($user->isOperator()) {
|
||||
return $user->getPermissionNames()->contains('ViewLoanOrders');
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -64,13 +72,17 @@ class LoanOrderPolicy
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($user->isOperator() && $user->getPermissionNames()->contains('ViewLoanOrders')) {
|
||||
return in_array(
|
||||
$loanOrder->branch_id,
|
||||
$user->branches->pluck('id')->toArray()
|
||||
);
|
||||
if ($user->isOperator()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// if ($user->isOperator() && $user->getPermissionNames()->contains('ViewLoanOrders')) {
|
||||
// return in_array(
|
||||
// $loanOrder->branch_id,
|
||||
// $user->branches->pluck('id')->toArray()
|
||||
// );
|
||||
// }
|
||||
|
||||
if ($user->ownsLoanOrder($loanOrder) && in_array($loanOrder->status, [
|
||||
OrderRepo::PENDING,
|
||||
])) {
|
||||
@@ -89,13 +101,17 @@ class LoanOrderPolicy
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($user->isOperator() && $user->getPermissionNames()->contains('ViewLoanOrders')) {
|
||||
return in_array(
|
||||
$loanOrder->branch_id,
|
||||
$user->branches->pluck('id')->toArray()
|
||||
);
|
||||
if ($user->isOperator()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// if ($user->isOperator() && $user->getPermissionNames()->contains('ViewLoanOrders')) {
|
||||
// return in_array(
|
||||
// $loanOrder->branch_id,
|
||||
// $user->branches->pluck('id')->toArray()
|
||||
// );
|
||||
// }
|
||||
|
||||
if ($user->ownsLoanOrder($loanOrder)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user