ldc-crm/app/Policies/BrandPolicy.php

64 lines
1.2 KiB
PHP
Raw Permalink Normal View History

2023-06-20 17:37:15 +02:00
<?php
namespace App\Policies;
use App\Enums\Users\RoleEnum;
use App\Models\User;
use App\Policies\Rules\UserStaticRules;
2023-06-20 17:37:15 +02:00
class BrandPolicy
{
/**
* View a Brand.
*
* @return boolean
*/
public function view(): bool
{
return UserStaticRules::noOne();
2023-06-20 17:37:15 +02:00
}
/**
* ViewAny a Brand.
*
* @param \App\Models\User $authUser
2023-06-20 17:37:15 +02:00
* @return boolean
*/
public function viewAny(User $authUser): bool
2023-06-20 17:37:15 +02:00
{
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
2023-06-20 17:37:15 +02:00
}
/**
* Create a Brand.
*
* @param \App\Models\User $authUser
2023-06-20 17:37:15 +02:00
* @return boolean
*/
public function create(User $authUser): bool
2023-06-20 17:37:15 +02:00
{
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
2023-06-20 17:37:15 +02:00
}
/**
* Update a Brand.
*
* @param \App\Models\User $authUser
2023-06-20 17:37:15 +02:00
* @return boolean
*/
public function update(User $authUser): bool
2023-06-20 17:37:15 +02:00
{
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
2023-06-20 17:37:15 +02:00
}
/**
* Delete a Brand.
*
* @return boolean
*/
public function delete(): bool
{
return UserStaticRules::noOne();
2023-06-20 17:37:15 +02:00
}
}