- Fix EventType deletion error handling (constraint violations) - Fix Event update error (package_id column missing) - Fix Event Type dropdown options (JSON display issue) - Fix EventPackagesRelationManager query error - Add missing translations for deletion errors - Apply Pint formatting
33 lines
754 B
PHP
33 lines
754 B
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\EventResource\Pages;
|
|
|
|
use App\Filament\Resources\EventResource;
|
|
use App\Filament\Resources\Pages\AuditedCreateRecord;
|
|
|
|
class CreateEvent extends AuditedCreateRecord
|
|
{
|
|
protected static string $resource = EventResource::class;
|
|
|
|
public ?int $packageId = null;
|
|
|
|
protected function mutateFormDataBeforeCreate(array $data): array
|
|
{
|
|
$this->packageId = $data['package_id'] ?? null;
|
|
unset($data['package_id']);
|
|
|
|
return $data;
|
|
}
|
|
|
|
protected function afterCreate(): void
|
|
{
|
|
if ($this->packageId) {
|
|
$this->record->eventPackages()->create([
|
|
'package_id' => $this->packageId,
|
|
]);
|
|
}
|
|
|
|
parent::afterCreate();
|
|
}
|
|
}
|