ldc-gen-game-web/app/Policies/PrizePolicy.php
2025-08-29 14:46:51 +02:00

70 lines
1.7 KiB
PHP

<?php
namespace App\Policies;
use App\Models\User;
use App\Policies\Rules\UserStaticRules;
class PrizePolicy
{
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function viewAny(User $authUser): bool
{
return UserStaticRules::restrictTenant($authUser);
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function view(User $authUser): bool
{
return UserStaticRules::restrictTenant($authUser);
}
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function create(User $authUser): bool
{
/** @var \App\Models\Settings */
$settings = \tenant()->setting;
return !$settings->game_is_open and UserStaticRules::restrictTenant($authUser);
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function update(User $authUser): bool
{
/** @var \App\Models\Settings */
$settings = \tenant()->setting;
return !$settings->game_is_open and UserStaticRules::restrictTenant($authUser);
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function delete(User $authUser): bool
{
/** @var \App\Models\Settings */
$settings = \tenant()->setting;
return !$settings->game_is_open and UserStaticRules::restrictTenant($authUser);
}
}