merge([$f => $this->dec($this->$f)]); } } public function rules(): array { return [ // Unikalność: nazwa + napięcie (jak legacy). 'name' => ['required', 'string', 'max:128', Rule::unique('seg_engines', 'ENG_NAME')->where(fn ($q) => $q->where('ENG_VOLTAGE', $this->voltage))], 'manufacturer_id' => ['required', 'integer', 'exists:seg_manufacturers,MCF_ID'], 'power' => ['required', 'numeric'], 'voltage' => ['required', 'numeric'], 'current' => ['nullable', 'numeric'], 'eta' => ['nullable', 'numeric'], 'cos_fi' => ['nullable', 'numeric'], 'rpm' => ['nullable', 'numeric'], 'length' => ['nullable', 'numeric'], 'weight' => ['nullable', 'numeric'], 'diameter' => ['nullable', 'numeric'], 'wires' => ['nullable', 'string', 'max:32'], ]; } private function dec(mixed $v): ?string { return $v === null || $v === '' ? null : str_replace(',', '.', (string) $v); } }