37 lines
924 B
PHP
37 lines
924 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Policies;
|
||
|
|
|
||
|
|
use App\Enums\Users\RoleEnum;
|
||
|
|
use App\Models\StaticPage;
|
||
|
|
use App\Models\User;
|
||
|
|
use App\Policies\Rules\UserStaticRules;
|
||
|
|
|
||
|
|
class StaticPagePolicy
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Determine whether the user can view any models.
|
||
|
|
*
|
||
|
|
* @param \App\Models\User $authUser
|
||
|
|
* @return boolean
|
||
|
|
*/
|
||
|
|
public function viewAny(User $authUser): bool
|
||
|
|
{
|
||
|
|
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Determine whether the user can update the model.
|
||
|
|
*
|
||
|
|
* @param \App\Models\User $authUser
|
||
|
|
* @param \App\Models\StaticPage $static_page
|
||
|
|
* @return boolean
|
||
|
|
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
|
||
|
|
*/
|
||
|
|
public function update(User $authUser, StaticPage $static_page): bool
|
||
|
|
{
|
||
|
|
// phpcs:enable
|
||
|
|
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
|
||
|
|
}
|
||
|
|
}
|