63 lines
1.2 KiB
PHP
63 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Policies;
|
|
|
|
use App\Enums\Users\RoleEnum;
|
|
use App\Models\User;
|
|
use App\Policies\Rules\UserStaticRules;
|
|
|
|
class BrandPolicy
|
|
{
|
|
/**
|
|
* View a Brand.
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function view(): bool
|
|
{
|
|
return UserStaticRules::noOne();
|
|
}
|
|
|
|
/**
|
|
* ViewAny a Brand.
|
|
*
|
|
* @param \App\Models\User $authUser
|
|
* @return boolean
|
|
*/
|
|
public function viewAny(User $authUser): bool
|
|
{
|
|
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
|
|
}
|
|
|
|
/**
|
|
* Create a Brand.
|
|
*
|
|
* @param \App\Models\User $authUser
|
|
* @return boolean
|
|
*/
|
|
public function create(User $authUser): bool
|
|
{
|
|
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
|
|
}
|
|
|
|
/**
|
|
* Update a Brand.
|
|
*
|
|
* @param \App\Models\User $authUser
|
|
* @return boolean
|
|
*/
|
|
public function update(User $authUser): bool
|
|
{
|
|
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
|
|
}
|
|
|
|
/**
|
|
* Delete a Brand.
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function delete(): bool
|
|
{
|
|
return UserStaticRules::noOne();
|
|
}
|
|
}
|