- LeavePolicyController: 휴가 정책 CRUD API - LeavePolicyService: 정책 관리 로직 - LeavePolicy 모델: 다중 테넌트 지원 - FormRequest 검증 클래스 - Swagger 문서화 - leave_policies 테이블 마이그레이션 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
42 lines
1.7 KiB
PHP
42 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\LeavePolicy;
|
|
|
|
use App\Models\Tenants\LeavePolicy;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class UpdateRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'standard_type' => ['sometimes', Rule::in(LeavePolicy::STANDARD_TYPES)],
|
|
'fiscal_start_month' => ['sometimes', 'integer', 'min:1', 'max:12'],
|
|
'fiscal_start_day' => ['sometimes', 'integer', 'min:1', 'max:31'],
|
|
'default_annual_leave' => ['sometimes', 'integer', 'min:0', 'max:100'],
|
|
'additional_leave_per_year' => ['sometimes', 'integer', 'min:0', 'max:10'],
|
|
'max_annual_leave' => ['sometimes', 'integer', 'min:0', 'max:100'],
|
|
'carry_over_enabled' => ['sometimes', 'boolean'],
|
|
'carry_over_max_days' => ['sometimes', 'integer', 'min:0', 'max:100'],
|
|
'carry_over_expiry_months' => ['sometimes', 'integer', 'min:0', 'max:24'],
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'standard_type.in' => __('validation.in', ['attribute' => '기준 유형']),
|
|
'fiscal_start_month.min' => __('validation.min.numeric', ['attribute' => '기준월', 'min' => 1]),
|
|
'fiscal_start_month.max' => __('validation.max.numeric', ['attribute' => '기준월', 'max' => 12]),
|
|
'fiscal_start_day.min' => __('validation.min.numeric', ['attribute' => '기준일', 'min' => 1]),
|
|
'fiscal_start_day.max' => __('validation.max.numeric', ['attribute' => '기준일', 'max' => 31]),
|
|
];
|
|
}
|
|
}
|