35 lines
731 B
PHP
35 lines
731 B
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace App\Policies;
|
|
|
|
use App\Models\Role;
|
|
use App\Models\User;
|
|
|
|
final readonly class RolePolicy extends Policy
|
|
{
|
|
public function viewAny(User $user): bool
|
|
{
|
|
return $user->hasPermission('role.view');
|
|
}
|
|
|
|
public function view(User $user, Role $role): bool
|
|
{
|
|
return $user->hasPermission('role.view');
|
|
}
|
|
|
|
public function create(User $user): bool
|
|
{
|
|
return $user->hasPermission('role.create');
|
|
}
|
|
|
|
public function update(User $user, Role $role): bool
|
|
{
|
|
return $user->hasPermission('role.update');
|
|
}
|
|
|
|
public function delete(User $user, Role $role): bool
|
|
{
|
|
return $user->hasPermission('role.delete');
|
|
}
|
|
}
|