25 lines
412 B
PHP
25 lines
412 B
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace App\Policies;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Auth\Access\HandlesAuthorization;
|
|
|
|
abstract readonly class Policy
|
|
{
|
|
use HandlesAuthorization;
|
|
|
|
/**
|
|
* @param User $user
|
|
* @return bool|null
|
|
*/
|
|
final public function before(User $user): ?bool
|
|
{
|
|
if ($user->is_admin) {
|
|
return true;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|