Files
sam-api/app/Http/Requests/Api/V1/BendingItemStoreRequest.php
강영보 d6591acdff refactor: [절곡] code/lot_no 분리 — 코드 체계와 LOT 번호 분리
- bending_items.code: LOT번호(CP260319) → 코드체계(CP)만 저장
- bending_items.lot_no: 기존 code 값 이관 (LOT 번호)
- bending_models.code: 전체코드(GR-KSS01-벽면형-SUS) → 접두사(GR)만 저장
- bending_models.lot_no: 기존 code 값 이관
- unique 제약: code → lot_no로 이동
- BendingCodeService.resolveItem: LIKE → 정확 매칭
- 검색: lot_no 필드 추가
- Swagger 문서 업데이트
2026-03-21 15:06:55 +09:00

50 lines
1.9 KiB
PHP

<?php
namespace App\Http\Requests\Api\V1;
use Illuminate\Foundation\Http\FormRequest;
class BendingItemStoreRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'code' => 'required|string|max:10',
'lot_no' => [
'nullable', 'string', 'max:50',
\Illuminate\Validation\Rule::unique('bending_items', 'lot_no')->where('tenant_id', request()->header('X-TENANT-ID', app()->bound('tenant_id') ? app('tenant_id') : 1)),
],
'item_name' => 'required|string|max:50',
'item_sep' => 'required|in:스크린,철재',
'item_bending' => 'required|string|max:50',
'material' => 'required|string|max:50',
'model_UA' => 'nullable|in:인정,비인정',
'item_spec' => 'nullable|string|max:50',
'model_name' => 'nullable|string|max:30',
'search_keyword' => 'nullable|string|max:100',
'rail_width' => 'nullable|integer',
'memo' => 'nullable|string|max:500',
'author' => 'nullable|string|max:50',
'registration_date' => 'nullable|date',
// 케이스 전용
'exit_direction' => 'nullable|string|max:30',
'front_bottom_width' => 'nullable|integer',
'box_width' => 'nullable|integer',
'box_height' => 'nullable|integer',
// 전개도
'bendingData' => 'nullable|array',
'bendingData.*.no' => 'required|integer',
'bendingData.*.input' => 'required|numeric',
'bendingData.*.rate' => 'nullable|string',
'bendingData.*.sum' => 'required|numeric',
'bendingData.*.color' => 'required|boolean',
'bendingData.*.aAngle' => 'required|boolean',
];
}
}