update to filament v4

This commit is contained in:
salam committed 2025-11-29 09:46:15 +01:00
1 parent 38e841bd73
commit 4b4c8427d8
59 files changed
+2559 -1982

No files matched your search

+27 -65
View File
@@ -1,108 +1,70 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use App\Models\User;
use Illuminate\Foundation\Auth\User as AuthUser;
use App\Models\Bookmaker;
use Illuminate\Auth\Access\HandlesAuthorization;
class BookmakerPolicy
{
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_bookmakers::bookmaker');
return $authUser->can('ViewAny:Bookmaker');
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Bookmaker $bookmaker): bool
public function view(AuthUser $authUser, Bookmaker $bookmaker): bool
{
return $user->can('view_bookmakers::bookmaker');
return $authUser->can('View:Bookmaker');
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
public function create(AuthUser $authUser): bool
{
return $user->can('create_bookmakers::bookmaker');
return $authUser->can('Create:Bookmaker');
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Bookmaker $bookmaker): bool
public function update(AuthUser $authUser, Bookmaker $bookmaker): bool
{
return $user->can('update_bookmakers::bookmaker');
return $authUser->can('Update:Bookmaker');
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Bookmaker $bookmaker): bool
public function delete(AuthUser $authUser, Bookmaker $bookmaker): bool
{
return $user->can('delete_bookmakers::bookmaker');
return $authUser->can('Delete:Bookmaker');
}
/**
* Determine whether the user can bulk delete.
*/
public function deleteAny(User $user): bool
public function restore(AuthUser $authUser, Bookmaker $bookmaker): bool
{
return $user->can('delete_any_bookmakers::bookmaker');
return $authUser->can('Restore:Bookmaker');
}
/**
* Determine whether the user can permanently delete.
*/
public function forceDelete(User $user, Bookmaker $bookmaker): bool
public function forceDelete(AuthUser $authUser, Bookmaker $bookmaker): bool
{
return $user->can('force_delete_bookmakers::bookmaker');
return $authUser->can('ForceDelete:Bookmaker');
}
/**
* 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_bookmakers::bookmaker');
return $authUser->can('ForceDeleteAny:Bookmaker');
}
/**
* Determine whether the user can restore.
*/
public function restore(User $user, Bookmaker $bookmaker): bool
public function restoreAny(AuthUser $authUser): bool
{
return $user->can('restore_bookmakers::bookmaker');
return $authUser->can('RestoreAny:Bookmaker');
}
/**
* Determine whether the user can bulk restore.
*/
public function restoreAny(User $user): bool
public function replicate(AuthUser $authUser, Bookmaker $bookmaker): bool
{
return $user->can('restore_any_bookmakers::bookmaker');
return $authUser->can('Replicate:Bookmaker');
}
/**
* Determine whether the user can replicate.
*/
public function replicate(User $user, Bookmaker $bookmaker): bool
public function reorder(AuthUser $authUser): bool
{
return $user->can('replicate_bookmakers::bookmaker');
return $authUser->can('Reorder:Bookmaker');
}
/**
* Determine whether the user can reorder.
*/
public function reorder(User $user): bool
{
return $user->can('reorder_bookmakers::bookmaker');
}
}
}