- MaterialStoreRequest.php 생성 (검증 로직 분리) - MaterialUpdateRequest.php 생성 (검증 로직 분리) - MaterialApi.php 경로 수정 (/api/v1/products/materials) - MaterialController.php Swagger 주석 제거, FormRequest 적용 - lang/ko/message.php material 메시지 키 추가 - SAM API Development Rules 준수 완료
32 lines
984 B
PHP
32 lines
984 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Material;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class MaterialUpdateRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'category_id' => 'nullable|integer',
|
|
'name' => 'sometimes|string|max:100',
|
|
'unit' => 'sometimes|string|max:20',
|
|
'is_inspection' => 'nullable|in:Y,N',
|
|
'search_tag' => 'nullable|string|max:255',
|
|
'remarks' => 'nullable|string|max:500',
|
|
'attributes' => 'nullable|array',
|
|
'attributes.*.label' => 'required|string|max:50',
|
|
'attributes.*.value' => 'required|string|max:100',
|
|
'attributes.*.unit' => 'nullable|string|max:20',
|
|
'options' => 'nullable|array',
|
|
'material_code' => 'nullable|string|max:30',
|
|
'specification' => 'nullable|string|max:255',
|
|
];
|
|
}
|
|
} |