Leonid Nikitin
b7d0a2453e
Otherwise phpstorm doesn't understand the paths correctly. He thinks that this is not a complete application, but a package. And when creating a class, the namespace indicates “app” with a small letter, but should be “App”.
21 lines
346 B
PHP
21 lines
346 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;
|
|
|
|
final public function before(User $user): ?bool
|
|
{
|
|
if ($user->is_admin) {
|
|
return true;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|