feat(User,Role): add users and role , permssion , filament panel | [USER , ROLE]

This commit is contained in:
2026-05-29 15:28:56 +03:30
parent d923019dc5
commit 1c408130d0
71 changed files with 3111 additions and 11 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Policies;
use App\Models\User;
class UserPolicy
{
public function viewAny(User $user): bool
{
return $this->canManage($user);
}
public function view(User $user, User $model): bool
{
return $this->canManage($user);
}
public function create(User $user): bool
{
return $this->canManage($user);
}
public function update(User $user, User $model): bool
{
return $this->canManage($user);
}
public function delete(User $user, User $model): bool
{
return $this->canManage($user);
}
public function deleteAny(User $user): bool
{
return $this->canManage($user);
}
private function canManage(User $user): bool
{
return $user->hasRole('admin') || $user->hasPermission('users.manage');
}
}