update to filament v4
This commit is contained in:
1 parent
38e841bd73
commit
4b4c8427d8
59 files changed
+2559
-1982
No files matched your search
@@ -8,5 +8,5 @@ use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class MaintenanceCluster extends Cluster
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedSquares2x2;
|
||||
protected static string | \BackedEnum | null $navigationIcon = Heroicon::OutlinedSquares2x2;
|
||||
}
|
||||
@@ -19,11 +19,11 @@ class EventResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-goal';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'lucide-goal';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Data';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Data';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ use UnitEnum;
|
||||
|
||||
class Monitor extends Page
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-monitor';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'lucide-monitor';
|
||||
|
||||
protected string $view = 'filament.pages.monitor';
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@ class BookmakerResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 21;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-notebook-pen';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'lucide-notebook-pen';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Administration';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Administration';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
|
||||
@@ -19,11 +19,11 @@ class ClientResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 32;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-square-user';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'lucide-square-user';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'User Management';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'User Management';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
|
||||
@@ -26,11 +26,11 @@ class CountryResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 22;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-flag';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'lucide-flag';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Administration';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Administration';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@ class ProviderResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 23;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-arrow-down-up';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'lucide-arrow-down-up';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Administration';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Administration';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@ class SportResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 24;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-volleyball';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'lucide-volleyball';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Administration';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Administration';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
|
||||
@@ -17,11 +17,11 @@ class SupervisorResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Supervisor::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-sliders-vertical';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'lucide-sliders-vertical';
|
||||
|
||||
protected static ?int $navigationSort = 20;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Administration';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Administration';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
|
||||
@@ -19,13 +19,13 @@ class UserResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 31;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-user';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'lucide-user';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'User Management';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'User Management';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Database\Factories\UserFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
@@ -10,7 +11,7 @@ use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||
/** @use HasFactory<UserFactory> */
|
||||
use HasFactory, HasRoles, Notifiable;
|
||||
|
||||
/**
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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\Client;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class ClientPolicy
|
||||
{
|
||||
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_clients::client');
|
||||
return $authUser->can('ViewAny:Client');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, Client $client): bool
|
||||
public function view(AuthUser $authUser, Client $client): bool
|
||||
{
|
||||
return $user->can('view_clients::client');
|
||||
return $authUser->can('View:Client');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('create_clients::client');
|
||||
return $authUser->can('Create:Client');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, Client $client): bool
|
||||
public function update(AuthUser $authUser, Client $client): bool
|
||||
{
|
||||
return $user->can('update_clients::client');
|
||||
return $authUser->can('Update:Client');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, Client $client): bool
|
||||
public function delete(AuthUser $authUser, Client $client): bool
|
||||
{
|
||||
return $user->can('delete_clients::client');
|
||||
return $authUser->can('Delete:Client');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk delete.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
public function restore(AuthUser $authUser, Client $client): bool
|
||||
{
|
||||
return $user->can('delete_any_clients::client');
|
||||
return $authUser->can('Restore:Client');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete.
|
||||
*/
|
||||
public function forceDelete(User $user, Client $client): bool
|
||||
public function forceDelete(AuthUser $authUser, Client $client): bool
|
||||
{
|
||||
return $user->can('force_delete_clients::client');
|
||||
return $authUser->can('ForceDelete:Client');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_clients::client');
|
||||
return $authUser->can('ForceDeleteAny:Client');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore.
|
||||
*/
|
||||
public function restore(User $user, Client $client): bool
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('restore_clients::client');
|
||||
return $authUser->can('RestoreAny:Client');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk restore.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
public function replicate(AuthUser $authUser, Client $client): bool
|
||||
{
|
||||
return $user->can('restore_any_clients::client');
|
||||
return $authUser->can('Replicate:Client');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate.
|
||||
*/
|
||||
public function replicate(User $user, Client $client): bool
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('replicate_clients::client');
|
||||
return $authUser->can('Reorder:Client');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->can('reorder_clients::client');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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\Country;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class CountryPolicy
|
||||
{
|
||||
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_countries::country');
|
||||
return $authUser->can('ViewAny:Country');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, Country $country): bool
|
||||
public function view(AuthUser $authUser, Country $country): bool
|
||||
{
|
||||
return $user->can('view_countries::country');
|
||||
return $authUser->can('View:Country');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('create_countries::country');
|
||||
return $authUser->can('Create:Country');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, Country $country): bool
|
||||
public function update(AuthUser $authUser, Country $country): bool
|
||||
{
|
||||
return $user->can('update_countries::country');
|
||||
return $authUser->can('Update:Country');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, Country $country): bool
|
||||
public function delete(AuthUser $authUser, Country $country): bool
|
||||
{
|
||||
return $user->can('delete_countries::country');
|
||||
return $authUser->can('Delete:Country');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk delete.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
public function restore(AuthUser $authUser, Country $country): bool
|
||||
{
|
||||
return $user->can('delete_any_countries::country');
|
||||
return $authUser->can('Restore:Country');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete.
|
||||
*/
|
||||
public function forceDelete(User $user, Country $country): bool
|
||||
public function forceDelete(AuthUser $authUser, Country $country): bool
|
||||
{
|
||||
return $user->can('force_delete_countries::country');
|
||||
return $authUser->can('ForceDelete:Country');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_countries::country');
|
||||
return $authUser->can('ForceDeleteAny:Country');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore.
|
||||
*/
|
||||
public function restore(User $user, Country $country): bool
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('restore_countries::country');
|
||||
return $authUser->can('RestoreAny:Country');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk restore.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
public function replicate(AuthUser $authUser, Country $country): bool
|
||||
{
|
||||
return $user->can('restore_any_countries::country');
|
||||
return $authUser->can('Replicate:Country');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate.
|
||||
*/
|
||||
public function replicate(User $user, Country $country): bool
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('replicate_countries::country');
|
||||
return $authUser->can('Reorder:Country');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->can('reorder_countries::country');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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\Event;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class EventPolicy
|
||||
{
|
||||
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_events::event');
|
||||
return $authUser->can('ViewAny:Event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, Event $event): bool
|
||||
public function view(AuthUser $authUser, Event $event): bool
|
||||
{
|
||||
return $user->can('view_events::event');
|
||||
return $authUser->can('View:Event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('create_events::event');
|
||||
return $authUser->can('Create:Event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, Event $event): bool
|
||||
public function update(AuthUser $authUser, Event $event): bool
|
||||
{
|
||||
return $user->can('update_events::event');
|
||||
return $authUser->can('Update:Event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, Event $event): bool
|
||||
public function delete(AuthUser $authUser, Event $event): bool
|
||||
{
|
||||
return $user->can('delete_events::event');
|
||||
return $authUser->can('Delete:Event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk delete.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
public function restore(AuthUser $authUser, Event $event): bool
|
||||
{
|
||||
return $user->can('delete_any_events::event');
|
||||
return $authUser->can('Restore:Event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete.
|
||||
*/
|
||||
public function forceDelete(User $user, Event $event): bool
|
||||
public function forceDelete(AuthUser $authUser, Event $event): bool
|
||||
{
|
||||
return $user->can('force_delete_events::event');
|
||||
return $authUser->can('ForceDelete:Event');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_events::event');
|
||||
return $authUser->can('ForceDeleteAny:Event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore.
|
||||
*/
|
||||
public function restore(User $user, Event $event): bool
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('restore_events::event');
|
||||
return $authUser->can('RestoreAny:Event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk restore.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
public function replicate(AuthUser $authUser, Event $event): bool
|
||||
{
|
||||
return $user->can('restore_any_events::event');
|
||||
return $authUser->can('Replicate:Event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate.
|
||||
*/
|
||||
public function replicate(User $user, Event $event): bool
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('replicate_events::event');
|
||||
return $authUser->can('Reorder:Event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->can('reorder_events::event');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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\Provider;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class ProviderPolicy
|
||||
{
|
||||
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_providers::provider');
|
||||
return $authUser->can('ViewAny:Provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, Provider $provider): bool
|
||||
public function view(AuthUser $authUser, Provider $provider): bool
|
||||
{
|
||||
return $user->can('view_providers::provider');
|
||||
return $authUser->can('View:Provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('create_providers::provider');
|
||||
return $authUser->can('Create:Provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, Provider $provider): bool
|
||||
public function update(AuthUser $authUser, Provider $provider): bool
|
||||
{
|
||||
return $user->can('update_providers::provider');
|
||||
return $authUser->can('Update:Provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, Provider $provider): bool
|
||||
public function delete(AuthUser $authUser, Provider $provider): bool
|
||||
{
|
||||
return $user->can('delete_providers::provider');
|
||||
return $authUser->can('Delete:Provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk delete.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
public function restore(AuthUser $authUser, Provider $provider): bool
|
||||
{
|
||||
return $user->can('delete_any_providers::provider');
|
||||
return $authUser->can('Restore:Provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete.
|
||||
*/
|
||||
public function forceDelete(User $user, Provider $provider): bool
|
||||
public function forceDelete(AuthUser $authUser, Provider $provider): bool
|
||||
{
|
||||
return $user->can('force_delete_providers::provider');
|
||||
return $authUser->can('ForceDelete:Provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_providers::provider');
|
||||
return $authUser->can('ForceDeleteAny:Provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore.
|
||||
*/
|
||||
public function restore(User $user, Provider $provider): bool
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('restore_providers::provider');
|
||||
return $authUser->can('RestoreAny:Provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk restore.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
public function replicate(AuthUser $authUser, Provider $provider): bool
|
||||
{
|
||||
return $user->can('restore_any_providers::provider');
|
||||
return $authUser->can('Replicate:Provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate.
|
||||
*/
|
||||
public function replicate(User $user, Provider $provider): bool
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('replicate_providers::provider');
|
||||
return $authUser->can('Reorder:Provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->can('reorder_providers::provider');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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\Sport;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class SportPolicy
|
||||
{
|
||||
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_sports::sport');
|
||||
return $authUser->can('ViewAny:Sport');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, Sport $sport): bool
|
||||
public function view(AuthUser $authUser, Sport $sport): bool
|
||||
{
|
||||
return $user->can('view_sports::sport');
|
||||
return $authUser->can('View:Sport');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('create_sports::sport');
|
||||
return $authUser->can('Create:Sport');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, Sport $sport): bool
|
||||
public function update(AuthUser $authUser, Sport $sport): bool
|
||||
{
|
||||
return $user->can('update_sports::sport');
|
||||
return $authUser->can('Update:Sport');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, Sport $sport): bool
|
||||
public function delete(AuthUser $authUser, Sport $sport): bool
|
||||
{
|
||||
return $user->can('delete_sports::sport');
|
||||
return $authUser->can('Delete:Sport');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk delete.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
public function restore(AuthUser $authUser, Sport $sport): bool
|
||||
{
|
||||
return $user->can('delete_any_sports::sport');
|
||||
return $authUser->can('Restore:Sport');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete.
|
||||
*/
|
||||
public function forceDelete(User $user, Sport $sport): bool
|
||||
public function forceDelete(AuthUser $authUser, Sport $sport): bool
|
||||
{
|
||||
return $user->can('force_delete_sports::sport');
|
||||
return $authUser->can('ForceDelete:Sport');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_sports::sport');
|
||||
return $authUser->can('ForceDeleteAny:Sport');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore.
|
||||
*/
|
||||
public function restore(User $user, Sport $sport): bool
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('restore_sports::sport');
|
||||
return $authUser->can('RestoreAny:Sport');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk restore.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
public function replicate(AuthUser $authUser, Sport $sport): bool
|
||||
{
|
||||
return $user->can('restore_any_sports::sport');
|
||||
return $authUser->can('Replicate:Sport');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate.
|
||||
*/
|
||||
public function replicate(User $user, Sport $sport): bool
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('replicate_sports::sport');
|
||||
return $authUser->can('Reorder:Sport');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->can('reorder_sports::sport');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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\Supervisor;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class SupervisorPolicy
|
||||
{
|
||||
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_supervisors::supervisor');
|
||||
return $authUser->can('ViewAny:Supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, Supervisor $supervisor): bool
|
||||
public function view(AuthUser $authUser, Supervisor $supervisor): bool
|
||||
{
|
||||
return $user->can('view_supervisors::supervisor');
|
||||
return $authUser->can('View:Supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('create_supervisors::supervisor');
|
||||
return $authUser->can('Create:Supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, Supervisor $supervisor): bool
|
||||
public function update(AuthUser $authUser, Supervisor $supervisor): bool
|
||||
{
|
||||
return $user->can('update_supervisors::supervisor');
|
||||
return $authUser->can('Update:Supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, Supervisor $supervisor): bool
|
||||
public function delete(AuthUser $authUser, Supervisor $supervisor): bool
|
||||
{
|
||||
return $user->can('delete_supervisors::supervisor');
|
||||
return $authUser->can('Delete:Supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk delete.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
public function restore(AuthUser $authUser, Supervisor $supervisor): bool
|
||||
{
|
||||
return $user->can('delete_any_supervisors::supervisor');
|
||||
return $authUser->can('Restore:Supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete.
|
||||
*/
|
||||
public function forceDelete(User $user, Supervisor $supervisor): bool
|
||||
public function forceDelete(AuthUser $authUser, Supervisor $supervisor): bool
|
||||
{
|
||||
return $user->can('force_delete_supervisors::supervisor');
|
||||
return $authUser->can('ForceDelete:Supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_supervisors::supervisor');
|
||||
return $authUser->can('ForceDeleteAny:Supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore.
|
||||
*/
|
||||
public function restore(User $user, Supervisor $supervisor): bool
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('restore_supervisors::supervisor');
|
||||
return $authUser->can('RestoreAny:Supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk restore.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
public function replicate(AuthUser $authUser, Supervisor $supervisor): bool
|
||||
{
|
||||
return $user->can('restore_any_supervisors::supervisor');
|
||||
return $authUser->can('Replicate:Supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate.
|
||||
*/
|
||||
public function replicate(User $user, Supervisor $supervisor): bool
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('replicate_supervisors::supervisor');
|
||||
return $authUser->can('Reorder:Supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->can('reorder_supervisors::supervisor');
|
||||
}
|
||||
}
|
||||
}
|
||||
+25
-102
@@ -2,143 +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.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return bool
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
|
||||
public function viewAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('view_any_users::user');
|
||||
return $authUser->can('ViewAny:User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return bool
|
||||
*/
|
||||
public function view(User $user): bool
|
||||
public function view(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('view_users::user');
|
||||
return $authUser->can('View:User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return bool
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('create_users::user');
|
||||
return $authUser->can('Create:User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return bool
|
||||
*/
|
||||
public function update(User $user): bool
|
||||
public function update(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('update_users::user');
|
||||
return $authUser->can('Update:User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return bool
|
||||
*/
|
||||
public function delete(User $user): bool
|
||||
public function delete(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('delete_users::user');
|
||||
return $authUser->can('Delete:User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk delete.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
public function restore(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('delete_any_users::user');
|
||||
return $authUser->can('Restore:User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return bool
|
||||
*/
|
||||
public function forceDelete(User $user): bool
|
||||
public function forceDelete(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('force_delete_users::user');
|
||||
return $authUser->can('ForceDelete:User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently bulk delete.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return bool
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
public function forceDeleteAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('force_delete_any_users::user');
|
||||
return $authUser->can('ForceDeleteAny:User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return bool
|
||||
*/
|
||||
public function restore(User $user): bool
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('restore_users::user');
|
||||
return $authUser->can('RestoreAny:User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk restore.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return bool
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
public function replicate(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('restore_any_users::user');
|
||||
return $authUser->can('Replicate:User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk restore.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return bool
|
||||
*/
|
||||
public function replicate(User $user): bool
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $user->can('replicate_users::user');
|
||||
return $authUser->can('Reorder:User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return bool
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->can('reorder_users::user');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ class AdminPanelProvider extends PanelProvider
|
||||
->authMiddleware([
|
||||
Authenticate::class,
|
||||
])->plugins([
|
||||
FilamentShieldPlugin::make(),
|
||||
// FilamentShieldPlugin::make(),
|
||||
FilamentEditProfilePlugin::make()->shouldRegisterNavigation(false),
|
||||
LightSwitchPlugin::make()->position(Alignment::BottomCenter),
|
||||
FilamentBackgroundsPlugin::make()
|
||||
|
||||
Reference in new issue
Block a user