Fix Event & EventType resource issues and apply formatting
- 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
This commit is contained in:
@@ -8,4 +8,25 @@ 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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user