Files
sam-api/app/Http/Requests/Employee/StoreRequest.php
kent d6e18fb54e feat(API): 직책/직원/근태 관리 API 개선
- Position 모델: key 필드 추가 및 마이그레이션
- PositionSeeder: 기본 직책 시더 추가
- TenantUserProfile: 프로필 이미지 관련 필드 추가
- Employee Request: 직원 등록/수정 요청 검증 강화
- EmployeeService: 직원 관리 서비스 로직 개선
- AttendanceService: 근태 관리 서비스 개선

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 17:25:13 +09:00

69 lines
2.8 KiB
PHP

<?php
namespace App\Http\Requests\Employee;
use Illuminate\Foundation\Http\FormRequest;
class StoreRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
// users 테이블 필드
'user_id' => 'nullable|string|max:50|unique:users,user_id',
'name' => 'required|string|max:100',
'email' => 'required|email|max:255|unique:users,email',
'phone' => 'nullable|string|max:20',
'password' => 'nullable|string|min:8',
'is_active' => 'nullable|boolean',
// tenant_user_profiles 테이블 필드
'department_id' => 'nullable|integer|exists:departments,id',
'position_key' => 'nullable|string|max:50',
'job_title_key' => 'nullable|string|max:50',
'work_location_key' => 'nullable|string|max:50',
'employment_type_key' => 'nullable|string|max:50',
'employee_status' => 'nullable|in:active,leave,resigned',
'manager_user_id' => 'nullable|integer|exists:users,id',
'profile_photo_path' => 'nullable|string|max:255',
'display_name' => 'nullable|string|max:100',
// json_extra 필드
'employee_code' => 'nullable|string|max:50',
'resident_number' => 'nullable|string|max:255',
'gender' => 'nullable|in:male,female',
'address' => 'nullable|array',
'address.zipCode' => 'nullable|string|max:10',
'address.address1' => 'nullable|string|max:255',
'address.address2' => 'nullable|string|max:255',
'salary' => 'nullable|numeric|min:0',
'hire_date' => 'nullable|date',
'rank' => 'nullable|string|max:50',
'bank_account' => 'nullable|array',
'bank_account.bankName' => 'nullable|string|max:50',
'bank_account.accountNumber' => 'nullable|string|max:50',
'bank_account.accountHolder' => 'nullable|string|max:50',
'work_type' => 'nullable|in:regular,contract,parttime,intern',
'contract_info' => 'nullable|array',
'contract_info.start_date' => 'nullable|date',
'contract_info.end_date' => 'nullable|date',
'contract_info.external_company' => 'nullable|string|max:100',
];
}
public function messages(): array
{
return [
'name.required' => __('validation.required', ['attribute' => '이름']),
'email.required' => __('validation.required', ['attribute' => '이메일']),
'email.email' => __('validation.email', ['attribute' => '이메일']),
'email.unique' => __('validation.unique', ['attribute' => '이메일']),
];
}
}