upgrade to filament v4

This commit is contained in:
Jp
2026-02-19 01:26:02 +08:00
parent 90c92650b7
commit b95f23f223
122 changed files with 3615 additions and 3379 deletions

View File

@@ -2,106 +2,66 @@
namespace App\Policies;
use App\Models\User;
use Illuminate\Foundation\Auth\User as AuthUser;
use Illuminate\Auth\Access\HandlesAuthorization;
class UserPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
public function viewAny(AuthUser $authUser): bool
{
return $user->can('view_any_user');
return $authUser->can('ViewAny:User');
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user): bool
public function view(AuthUser $authUser): bool
{
return $user->can('view_user');
return $authUser->can('View:User');
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
public function create(AuthUser $authUser): bool
{
return $user->can('create_user');
return $authUser->can('Create:User');
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user): bool
public function update(AuthUser $authUser): bool
{
return $user->can('update_user');
return $authUser->can('Update:User');
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user): bool
public function delete(AuthUser $authUser): bool
{
return $user->can('delete_user');
return $authUser->can('Delete:User');
}
/**
* Determine whether the user can bulk delete.
*/
public function deleteAny(User $user): bool
public function restore(AuthUser $authUser): bool
{
return $user->can('delete_any_user');
return $authUser->can('Restore:User');
}
/**
* Determine whether the user can permanently delete.
*/
public function forceDelete(User $user): bool
public function forceDelete(AuthUser $authUser): bool
{
return $user->can('force_delete_user');
return $authUser->can('ForceDelete:User');
}
/**
* Determine whether the user can permanently bulk delete.
*/
public function forceDeleteAny(User $user): bool
public function forceDeleteAny(AuthUser $authUser): bool
{
return $user->can('force_delete_any_user');
return $authUser->can('ForceDeleteAny:User');
}
/**
* Determine whether the user can restore.
*/
public function restore(User $user): bool
public function restoreAny(AuthUser $authUser): bool
{
return $user->can('restore_user');
return $authUser->can('RestoreAny:User');
}
/**
* Determine whether the user can bulk restore.
*/
public function restoreAny(User $user): bool
public function replicate(AuthUser $authUser): bool
{
return $user->can('restore_any_user');
return $authUser->can('Replicate:User');
}
/**
* Determine whether the user can bulk restore.
*/
public function replicate(User $user): bool
public function reorder(AuthUser $authUser): bool
{
return $user->can('replicate_user');
return $authUser->can('Reorder:User');
}
/**
* Determine whether the user can reorder.
*/
public function reorder(User $user): bool
{
return $user->can('reorder_user');
}
}
}