- 마이그레이션 4개 (approval_forms, approval_lines, approvals, approval_steps) - 모델 4개 (ApprovalForm, ApprovalLine, Approval, ApprovalStep) - ApprovalService 비즈니스 로직 (양식/결재선 CRUD, 기안함/결재함/참조함, 결재 액션) - 컨트롤러 3개 (ApprovalFormController, ApprovalLineController, ApprovalController) - FormRequest 13개 (양식/결재선/문서 검증) - Swagger 문서 3개 (26개 엔드포인트) - i18n 메시지/에러 키 추가 - 라우트 26개 등록
41 lines
1.3 KiB
PHP
41 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Approval;
|
|
|
|
use App\Models\Tenants\ApprovalForm;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class FormUpdateRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
$categories = implode(',', ApprovalForm::CATEGORIES);
|
|
|
|
return [
|
|
'name' => 'nullable|string|max:100',
|
|
'code' => 'nullable|string|max:50|regex:/^[a-zA-Z0-9_-]+$/',
|
|
'category' => "nullable|string|in:{$categories}",
|
|
'template' => 'nullable|array',
|
|
'template.fields' => 'required_with:template|array',
|
|
'template.fields.*.name' => 'required_with:template.fields|string|max:50',
|
|
'template.fields.*.type' => 'required_with:template.fields|string|in:text,textarea,number,date,select,checkbox,file',
|
|
'template.fields.*.label' => 'required_with:template.fields|string|max:100',
|
|
'template.fields.*.required' => 'nullable|boolean',
|
|
'template.fields.*.options' => 'nullable|array',
|
|
'is_active' => 'nullable|boolean',
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'code.regex' => __('validation.regex', ['attribute' => '양식코드']),
|
|
];
|
|
}
|
|
}
|