Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m59s
Eine Zusammenstellung vor jedem Dokument (Angebot, Bestaetigung, Buchungsunterlagen extern), Dokumentart je Vorgangsart, Freigaben fuer Vorlagen und Dokumentarten, Schutz vor unvereinbarten Bedingungen bei Portalbuchungen (E-004), kein doppelter Versand, Absicherung Hold 0 bis Paket 7, A6-Aufenthaltsbestaetigung vorbereitet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\ContractTemplates\Pages;
|
|
|
|
use App\Filament\Resources\ContractTemplates\ContractTemplateResource;
|
|
use App\Models\ContractTemplate;
|
|
use Filament\Resources\Pages\CreateRecord;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class CreateContractTemplate extends CreateRecord
|
|
{
|
|
protected static string $resource = ContractTemplateResource::class;
|
|
|
|
/**
|
|
* A new template starts with version 1; further versions are made from an existing one.
|
|
*
|
|
* @param array<string, mixed> $data
|
|
* @return array<string, mixed>
|
|
*/
|
|
protected function mutateFormDataBeforeCreate(array $data): array
|
|
{
|
|
$data['version'] = 1;
|
|
|
|
return $data;
|
|
}
|
|
|
|
/**
|
|
* @param array<string, mixed> $data
|
|
*/
|
|
protected function handleRecordCreation(array $data): Model
|
|
{
|
|
$template = new ContractTemplate(collect($data)->except(['is_released', 'is_portal_terms'])->all());
|
|
$template->applyStatements((bool) ($data['is_released'] ?? false), (bool) ($data['is_portal_terms'] ?? false), (string) auth()->user()?->name);
|
|
$template->save();
|
|
|
|
return $template;
|
|
}
|
|
}
|