['required', 'string', 'max:65535'], 'occurred_at' => ['nullable', 'date_format:Y-m-d\TH:i:s'], ]; } public function withValidator(Validator $validator): void { $validator->after(function (Validator $validator) { $entry = $this->route('historyEntry'); if ($entry instanceof HistoryEntry && $entry->entryType?->requires_datetime && ! $this->filled('occurred_at') ) { $validator->errors()->add( 'occurred_at', 'Für diesen Verlaufstyp sind Datum und Uhrzeit erforderlich.' ); } }); } }