Initial commit

This commit is contained in:
2026-09-03 12:21:17 +02:00
commit 6d40da0410
155 changed files with 21554 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class UpdatePumpRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
protected function prepareForValidation(): void
{
$this->merge([
'length' => $this->dec($this->length),
'diameter' => $this->dec($this->diameter),
'weight' => $this->dec($this->weight),
'h' => collect($this->h ?? [])->map(fn ($v) => $this->dec($v))->all(),
'eta' => collect($this->eta ?? [])->map(fn ($v) => $this->dec($v))->all(),
]);
}
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:128', Rule::unique('seg_pumps', 'PUP_NAME')->ignore($this->route('pump'))],
'manufacturer_id' => ['required', 'integer', 'exists:seg_manufacturers,MCF_ID'],
'length' => ['nullable', 'numeric'],
'diameter' => ['nullable', 'numeric'],
'weight' => ['nullable', 'numeric'],
'h' => ['nullable', 'array'],
'h.*' => ['nullable', 'numeric'],
'eta' => ['nullable', 'array'],
'eta.*' => ['nullable', 'numeric'],
];
}
private function dec(mixed $v): ?string
{
return $v === null || $v === '' ? null : str_replace(',', '.', (string) $v);
}
}