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

33 lines
709 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace App\Policies\Backend;
use App\Dto\SettingDto;
use App\Models\Customer;
use App\Models\Setting;
use App\Models\User;
use Domain\Enums\UserRole;
class SettingPolicy
{
public function view(User | Customer $user, Setting | SettingDto | null $_ = null): bool
{
if ($user instanceof Customer) {
return false;
}
return $user->role->isAtLeastEqualsTo(UserRole::Admin);
}
public function update(User | Customer $user, Setting | SettingDto | null $_ = null): bool
{
if ($user instanceof Customer) {
return false;
}
return $user->role->isAtLeastEqualsTo(UserRole::Admin);
}
}