ldc-legaulois/app/Policies/BlockPolicy.php
2026-09-25 16:25:31 +02:00

69 lines
1.5 KiB
PHP

<?php
namespace App\Policies;
use App\Enums\Users\RoleEnum;
use App\Models\Block;
use App\Models\Customer;
use App\Models\User;
use App\Policies\Rules\UserStaticRules;
class BlockPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $authUser): bool
{
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
}
/**
* Determine whether the user can view the model.
*/
public function view(Customer $customer, Block $blockPage): bool
{
return true;
}
/**
* Determine whether the user can create models.
*/
public function create(Customer $customer): bool
{
return false;
}
/**
* Determine whether the user can update the model.
*/
public function update(User $authUser, Block $blockPage): bool
{
// phpcs:enable
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
}
/**
* Determine whether the user can delete the model.
*/
public function delete(Customer $customer, Block $blockPage): bool
{
return false;
}
/**
* Determine whether the user can restore the model.
*/
public function restore(Customer $customer, Block $blockPage): bool
{
return false;
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(Customer $customer, Block $blockPage): bool
{
return false;
}
}