['required', 'string', 'max:100'], 'phone_number' => ['required', 'string', new PhoneNumber], 'birthdate' => ['required', 'date', 'before:'.Carbon::now()->subYears(18)->format('Y-m-d')], 'address' => ['nullable', 'string'], 'gender' => ['required', Rule::in(Gender::cases())], ]; } public function validationAttributes(): array { return [ 'full_name' => 'nama lengkap', 'phone_number' => 'nomor telepon', 'base_salary' => 'gaji pokok', 'birthdate' => 'tanggal lahir', 'address' => 'alamat', 'gender' => 'jenis kelamin', ]; } public function setProfile(Employee $employee): void { $this->employee = $employee; $this->full_name = $employee->full_name; $this->phone_number = $employee->phone_number; $this->base_salary = $employee->base_salary; $this->birthdate = $employee->birthdate; $this->hire_date = formatDate($employee->hire_date); $this->address = $employee->address; $this->gender = $employee->gender->value; $this->status = $employee->status->label(); } public function update(): void { $this->validate(); $this->employee->update([ 'full_name' => $this->full_name, 'phone_number' => $this->phone_number, 'birthdate' => $this->birthdate, 'address' => $this->address, 'gender' => $this->gender, ]); } }