ldc-nature-eleveurs/app/Policies/GeneralConfigPolicy.php

33 lines
705 B
PHP
Raw Permalink Normal View History

2024-01-31 16:42:01 +01:00
<?php
namespace App\Policies;
use App\Enums\Users\RoleEnum;
use App\Models\User;
use App\Policies\Rules\UserStaticRules;
2024-02-01 10:19:11 +01:00
class GeneralConfigPolicy
2024-01-31 16:42:01 +01:00
{
/**
2024-02-01 10:19:11 +01:00
* Determine whether the user can view the model.
2024-01-31 16:42:01 +01:00
*
* @param \App\Models\User $authUser
* @return boolean
*/
2024-02-01 10:19:11 +01:00
public function view(User $authUser): bool
2024-01-31 16:42:01 +01:00
{
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
}
/**
* Determine whether the user can update the model.
*
2024-02-01 10:19:11 +01:00
* @param \App\Models\User $authUser
2024-01-31 16:42:01 +01:00
* @return boolean
*/
2024-02-01 10:19:11 +01:00
public function update(User $authUser): bool
2024-01-31 16:42:01 +01:00
{
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
}
}