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