Files
sam-manage/app/Http/Requests/StoreEquipmentRequest.php
김보곤 11a7f89216 feat: [equipment] 설비관리 모듈 구현
- 모델 6개 (Equipment, InspectionTemplate, Inspection, InspectionDetail, Repair, Process)
- 서비스 3개 (Equipment, Inspection, Repair)
- API 컨트롤러 3개 + FormRequest 4개
- Blade 컨트롤러 + 라우트 등록
- 뷰: 대시보드, 등록대장(CRUD), 일상점검표(캘린더 그리드), 수리이력
2026-02-26 13:28:18 +09:00

69 lines
2.2 KiB
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class StoreEquipmentRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
$tenantId = session('selected_tenant_id', 1);
return [
'equipment_code' => [
'required', 'string', 'max:20',
Rule::unique('equipments', 'equipment_code')
->where('tenant_id', $tenantId),
],
'name' => 'required|string|max:100',
'equipment_type' => 'nullable|string|max:50',
'specification' => 'nullable|string|max:255',
'manufacturer' => 'nullable|string|max:100',
'model_name' => 'nullable|string|max:100',
'serial_no' => 'nullable|string|max:100',
'location' => 'nullable|string|max:100',
'production_line' => 'nullable|string|max:50',
'purchase_date' => 'nullable|date',
'install_date' => 'nullable|date',
'purchase_price' => 'nullable|numeric|min:0',
'useful_life' => 'nullable|integer|min:0',
'status' => 'nullable|in:active,idle,disposed',
'disposed_date' => 'nullable|date',
'manager_id' => 'nullable|exists:users,id',
'photo_path' => 'nullable|string|max:500',
'memo' => 'nullable|string',
'is_active' => 'nullable|boolean',
'sort_order' => 'nullable|integer|min:0',
];
}
public function attributes(): array
{
return [
'equipment_code' => '설비코드',
'name' => '설비명',
'equipment_type' => '설비유형',
'manufacturer' => '제조사',
'purchase_date' => '구입일',
'install_date' => '설치일',
'purchase_price' => '구입가격',
];
}
public function messages(): array
{
return [
'equipment_code.required' => '설비코드는 필수입니다.',
'equipment_code.unique' => '이미 존재하는 설비코드입니다.',
'name.required' => '설비명은 필수입니다.',
];
}
}