40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
/**
|
|
* Walidacja edycji urządzenia opomiarowania (site208E). Reguły jak przy
|
|
* dodawaniu; wgranie nowego pliku zastępuje dotychczasowy tej samej roli.
|
|
*/
|
|
class UpdateMeteringRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'name' => ['required', 'string', 'max:255'],
|
|
'manufacturer_id' => ['required', 'integer', 'exists:seg_manufacturers,MCF_ID'],
|
|
'description' => ['nullable', 'string', 'max:255'],
|
|
'catalogue_file' => ['nullable', 'file', 'mimes:pdf,doc,docx,xls,xlsx,ppt,pptx', 'max:8192'],
|
|
'image_file' => ['nullable', 'image', 'mimes:jpg,jpeg,png,gif,bmp', 'max:8192'],
|
|
];
|
|
}
|
|
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'name' => 'nazwa',
|
|
'manufacturer_id' => 'producent',
|
|
'description' => 'opis',
|
|
'catalogue_file' => 'dokumentacja katalogowa',
|
|
'image_file' => 'zdjęcie',
|
|
];
|
|
}
|
|
}
|