Files
sam-api/app/Http/Requests/Inspection/InspectionUpdateRequest.php

29 lines
830 B
PHP
Raw Normal View History

<?php
namespace App\Http\Requests\Inspection;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class InspectionUpdateRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'items' => ['nullable', 'array'],
'items.*.id' => ['required_with:items', 'string'],
'items.*.result' => ['nullable', 'string', 'max:20'],
'items.*.measured_value' => ['nullable', 'numeric'],
'items.*.judgment' => ['nullable', Rule::in(['pass', 'fail'])],
'result' => ['nullable', Rule::in(['pass', 'fail'])],
'remarks' => ['nullable', 'string', 'max:1000'],
'opinion' => ['nullable', 'string', 'max:2000'],
];
}
}