2026-01-14 17:08:59 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Inspection;
|
|
|
|
|
|
|
|
|
|
use App\Models\Qualitys\Inspection;
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
use Illuminate\Validation\Rule;
|
|
|
|
|
|
|
|
|
|
class InspectionStoreRequest extends FormRequest
|
|
|
|
|
{
|
|
|
|
|
public function authorize(): bool
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function rules(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'inspection_type' => ['required', Rule::in([
|
|
|
|
|
Inspection::TYPE_IQC,
|
|
|
|
|
Inspection::TYPE_PQC,
|
|
|
|
|
Inspection::TYPE_FQC,
|
|
|
|
|
])],
|
|
|
|
|
'lot_no' => ['required', 'string', 'max:50'],
|
2026-02-27 15:59:02 +09:00
|
|
|
'work_order_id' => ['nullable', 'integer', 'exists:work_orders,id'],
|
2026-01-14 17:08:59 +09:00
|
|
|
'item_name' => ['nullable', 'string', 'max:200'],
|
|
|
|
|
'process_name' => ['nullable', 'string', 'max:100'],
|
|
|
|
|
'quantity' => ['nullable', 'numeric', 'min:0'],
|
|
|
|
|
'unit' => ['nullable', 'string', 'max:20'],
|
|
|
|
|
'inspector_id' => ['nullable', 'integer', 'exists:users,id'],
|
|
|
|
|
'remarks' => ['nullable', 'string', 'max:1000'],
|
|
|
|
|
'items' => ['nullable', 'array'],
|
|
|
|
|
'items.*.name' => ['required_with:items', 'string', 'max:200'],
|
|
|
|
|
'items.*.type' => ['required_with:items', Rule::in(['quality', 'measurement'])],
|
|
|
|
|
'items.*.spec' => ['required_with:items', 'string', 'max:200'],
|
|
|
|
|
'items.*.unit' => ['nullable', 'string', 'max:20'],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function messages(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'inspection_type.required' => __('validation.required', ['attribute' => '검사유형']),
|
|
|
|
|
'inspection_type.in' => __('validation.in', ['attribute' => '검사유형']),
|
|
|
|
|
'lot_no.required' => __('validation.required', ['attribute' => 'LOT번호']),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|