wip supervisor
This commit is contained in:
1 parent
e46722a6f8
commit
769fbc242c
40 files changed
+834
-52
No files matched your search
@@ -33,6 +33,9 @@ class Grapper extends Command
|
||||
public function handle()
|
||||
{
|
||||
self::$options = $this->options();
|
||||
|
||||
dd(self::$options);
|
||||
|
||||
self::$options['supervisor_id'] = $this->argument('process');
|
||||
self::$options['event_id'] = $this->argument('eventid');
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Maintenance\Resources\Events;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
|
||||
use App\Filament\Clusters\Maintenance\Resources\Events\Pages\CreateEvent;
|
||||
use App\Filament\Clusters\Maintenance\Resources\Events\Pages\EditEvent;
|
||||
use App\Filament\Clusters\Maintenance\Resources\Events\Pages\ListEvents;
|
||||
use App\Filament\Clusters\Maintenance\Resources\Events\Schemas\EventForm;
|
||||
use App\Filament\Clusters\Maintenance\Resources\Events\Tables\EventsTable;
|
||||
use App\Models\Event;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class EventResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Event::class;
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-goal';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Data';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return EventForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return EventsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListEvents::route('/'),
|
||||
'create' => CreateEvent::route('/create'),
|
||||
'edit' => EditEvent::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Maintenance\Resources\Events\Pages;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\Resources\Events\EventResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateEvent extends CreateRecord
|
||||
{
|
||||
protected static string $resource = EventResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Maintenance\Resources\Events\Pages;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\Resources\Events\EventResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditEvent extends EditRecord
|
||||
{
|
||||
protected static string $resource = EventResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Maintenance\Resources\Events\Pages;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\Resources\Events\EventResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListEvents extends ListRecords
|
||||
{
|
||||
protected static string $resource = EventResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Maintenance\Resources\Events\Schemas;
|
||||
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class EventForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
DateTimePicker::make('time'),
|
||||
TextInput::make('spid')
|
||||
->required()
|
||||
->numeric(),
|
||||
TextInput::make('prid')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('txid')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('brid')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('baid')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('cnid')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('grid')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('cgid')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('hoid')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('awid')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('liga')
|
||||
->required(),
|
||||
TextInput::make('home')
|
||||
->required(),
|
||||
TextInput::make('away')
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Maintenance\Resources\Events\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class EventsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('time')
|
||||
->dateTime()
|
||||
->sortable(),
|
||||
TextColumn::make('spid')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('prid')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('txid')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('brid')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('baid')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('cnid')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('grid')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('cgid')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('hoid')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('awid')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('liga')
|
||||
->searchable(),
|
||||
TextColumn::make('home')
|
||||
->searchable(),
|
||||
TextColumn::make('away')
|
||||
->searchable(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,8 @@ class BookmakerResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Bookmaker::class;
|
||||
|
||||
protected static ?int $navigationSort = 21;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-notebook-pen';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
@@ -18,6 +18,7 @@ class BookmakerForm
|
||||
->required(),
|
||||
FileUpload::make('image')
|
||||
->preserveFilenames()
|
||||
->columnSpan(2)
|
||||
->default(null),
|
||||
TextInput::make('baid')
|
||||
->numeric()
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace App\Filament\Resources\Bookmakers\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
@@ -41,6 +39,7 @@ class BookmakersTable
|
||||
ToggleColumn::make('direct')->offColor('gray'),
|
||||
ToggleColumn::make('is_active')->offColor('gray'),
|
||||
])
|
||||
->defaultSort('name')
|
||||
->filters([
|
||||
TernaryFilter::make('txso'),
|
||||
TernaryFilter::make('txot'),
|
||||
@@ -50,11 +49,6 @@ class BookmakersTable
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -17,12 +17,12 @@ class ClientResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Client::class;
|
||||
|
||||
protected static ?int $navigationSort = 32;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-square-user';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
protected static ?int $navigationSort = 30;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'User Management';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
|
||||
@@ -20,7 +20,7 @@ class CountryResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Country::class;
|
||||
|
||||
// protected static bool $shouldSkipAuthorization = true;
|
||||
protected static ?int $navigationSort = 22;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-flag';
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ class ProviderResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Provider::class;
|
||||
|
||||
protected static ?int $navigationSort = 23;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-arrow-down-up';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
@@ -19,14 +19,12 @@ class SportResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Sport::class;
|
||||
|
||||
protected static ?int $navigationSort = 24;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-volleyball';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $navigationLabel = 'Sport';
|
||||
|
||||
protected static ?string $pluralLabel = 'Sports';
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Administration';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Supervisors\Pages;
|
||||
|
||||
use App\Filament\Resources\Supervisors\SupervisorResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateSupervisor extends CreateRecord
|
||||
{
|
||||
protected static string $resource = SupervisorResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Supervisors\Pages;
|
||||
|
||||
use App\Filament\Resources\Supervisors\SupervisorResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSupervisor extends EditRecord
|
||||
{
|
||||
protected static string $resource = SupervisorResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Supervisors\Pages;
|
||||
|
||||
use App\Filament\Resources\Supervisors\SupervisorResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListSupervisors extends ListRecords
|
||||
{
|
||||
protected static string $resource = SupervisorResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Supervisors\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class SupervisorForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->default(null),
|
||||
TextInput::make('provider_id')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('sport_id')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('bookmaker_id')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('sleep')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(10),
|
||||
TextInput::make('limit')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('runtime')
|
||||
->default(null),
|
||||
TextInput::make('events')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
TextInput::make('lastcall')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
Toggle::make('is_cron')
|
||||
->required(),
|
||||
Toggle::make('is_active')
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Supervisors;
|
||||
|
||||
use App\Filament\Clusters\Maintenance\MaintenanceCluster;
|
||||
use App\Filament\Resources\Supervisors\Pages\CreateSupervisor;
|
||||
use App\Filament\Resources\Supervisors\Pages\EditSupervisor;
|
||||
use App\Filament\Resources\Supervisors\Pages\ListSupervisors;
|
||||
use App\Filament\Resources\Supervisors\Schemas\SupervisorForm;
|
||||
use App\Filament\Resources\Supervisors\Tables\SupervisorsTable;
|
||||
use App\Models\Supervisor;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class SupervisorResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Supervisor::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-sliders-vertical';
|
||||
|
||||
protected static ?int $navigationSort = 20;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Administration';
|
||||
|
||||
protected static ?string $cluster = MaintenanceCluster::class;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return SupervisorForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return SupervisorsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListSupervisors::route('/'),
|
||||
'create' => CreateSupervisor::route('/create'),
|
||||
'edit' => EditSupervisor::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Supervisors\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SupervisorsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->searchable(),
|
||||
TextColumn::make('provider_id')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('sport_id')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('bookmaker_id')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('sleep')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('limit')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('runtime')
|
||||
->searchable(),
|
||||
TextColumn::make('events')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('lastcall')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
IconColumn::make('is_cron')
|
||||
->boolean(),
|
||||
IconColumn::make('is_active')
|
||||
->boolean(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Event extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\User;
|
||||
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
|
||||
{
|
||||
return $user->can('view_any_events::event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, Event $event): bool
|
||||
{
|
||||
return $user->can('view_events::event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->can('create_events::event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, Event $event): bool
|
||||
{
|
||||
return $user->can('update_events::event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, Event $event): bool
|
||||
{
|
||||
return $user->can('delete_events::event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk delete.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->can('delete_any_events::event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete.
|
||||
*/
|
||||
public function forceDelete(User $user, Event $event): bool
|
||||
{
|
||||
return $user->can('force_delete_events::event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently bulk delete.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->can('force_delete_any_events::event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore.
|
||||
*/
|
||||
public function restore(User $user, Event $event): bool
|
||||
{
|
||||
return $user->can('restore_events::event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk restore.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->can('restore_any_events::event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate.
|
||||
*/
|
||||
public function replicate(User $user, Event $event): bool
|
||||
{
|
||||
return $user->can('replicate_events::event');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->can('reorder_events::event');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\User;
|
||||
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
|
||||
{
|
||||
return $user->can('view_any_supervisors::supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, Supervisor $supervisor): bool
|
||||
{
|
||||
return $user->can('view_supervisors::supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->can('create_supervisors::supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, Supervisor $supervisor): bool
|
||||
{
|
||||
return $user->can('update_supervisors::supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, Supervisor $supervisor): bool
|
||||
{
|
||||
return $user->can('delete_supervisors::supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk delete.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->can('delete_any_supervisors::supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete.
|
||||
*/
|
||||
public function forceDelete(User $user, Supervisor $supervisor): bool
|
||||
{
|
||||
return $user->can('force_delete_supervisors::supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently bulk delete.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->can('force_delete_any_supervisors::supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore.
|
||||
*/
|
||||
public function restore(User $user, Supervisor $supervisor): bool
|
||||
{
|
||||
return $user->can('restore_supervisors::supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can bulk restore.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->can('restore_any_supervisors::supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate.
|
||||
*/
|
||||
public function replicate(User $user, Supervisor $supervisor): bool
|
||||
{
|
||||
return $user->can('replicate_supervisors::supervisor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->can('reorder_supervisors::supervisor');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user