ldc-cocotte/app/Policies/Backend/PickupExceptionPolicy.php

60 lines
1.4 KiB
PHP
Raw Permalink Normal View History

2026-06-14 21:32:07 +02:00
<?php
declare(strict_types=1);
namespace App\Policies\Backend;
use App\Dto\PickupExceptionDto;
2026-06-14 21:32:07 +02:00
use App\Models\Customer;
use App\Models\PickupException;
use App\Models\User;
use Domain\Enums\UserRole;
class PickupExceptionPolicy
{
public function viewAny(User | Customer $user): bool
{
if ($user instanceof Customer) {
return false;
}
return $user->role->isAtLeastEqualsTo(UserRole::Admin);
}
public function view(User | Customer $user, PickupException | PickupExceptionDto $_): bool
2026-06-14 21:32:07 +02:00
{
if ($user instanceof Customer) {
return false;
}
return $user->role->isAtLeastEqualsTo(UserRole::Admin);
}
public function create(User | Customer $user): bool
{
if ($user instanceof Customer) {
return false;
}
return $user->role->isAtLeastEqualsTo(UserRole::Admin);
}
public function update(User | Customer $user, PickupException | PickupExceptionDto $_): bool
2026-06-14 21:32:07 +02:00
{
if ($user instanceof Customer) {
return false;
}
return $user->role->isAtLeastEqualsTo(UserRole::Admin);
}
public function delete(User | Customer $user, PickupException | PickupExceptionDto $_): bool
2026-06-14 21:32:07 +02:00
{
if ($user instanceof Customer) {
return false;
}
return $user->role->isAtLeastEqualsTo(UserRole::Admin);
}
}