2025-11-30 21:05:44 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Item;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
|
|
|
|
|
class ItemBatchDeleteRequest extends FormRequest
|
|
|
|
|
{
|
|
|
|
|
public function authorize(): bool
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-21 01:10:38 +09:00
|
|
|
protected function prepareForValidation(): void
|
|
|
|
|
{
|
|
|
|
|
// type 파라미터를 item_type으로 매핑 (일관성)
|
|
|
|
|
if ($this->has('type') && ! $this->has('item_type')) {
|
|
|
|
|
$this->merge(['item_type' => $this->input('type')]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-30 21:05:44 +09:00
|
|
|
public function rules(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
2025-12-09 21:51:46 +09:00
|
|
|
'item_type' => 'required|string|in:FG,PT,SM,RM,CS',
|
2025-11-30 21:05:44 +09:00
|
|
|
'ids' => 'required|array|min:1',
|
|
|
|
|
'ids.*' => 'required|integer|min:1',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function messages(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
2025-12-09 21:51:46 +09:00
|
|
|
'item_type.required' => '품목 유형은 필수입니다.',
|
|
|
|
|
'item_type.in' => '품목 유형은 FG, PT, SM, RM, CS 중 하나여야 합니다.',
|
2025-11-30 21:05:44 +09:00
|
|
|
'ids.required' => '삭제할 품목 ID 목록은 필수입니다.',
|
|
|
|
|
'ids.array' => '품목 ID 목록은 배열이어야 합니다.',
|
|
|
|
|
'ids.min' => '삭제할 품목을 하나 이상 선택하세요.',
|
|
|
|
|
'ids.*.required' => '품목 ID는 필수입니다.',
|
|
|
|
|
'ids.*.integer' => '품목 ID는 정수여야 합니다.',
|
|
|
|
|
'ids.*.min' => '품목 ID는 1 이상이어야 합니다.',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|