EmploymentStatus::class, 'base_salary' => 'integer', 'join_date' => 'date:Y-m-d', 'resign_date' => 'date:Y-m-d', ]; } public function getActivitylogOptions(): LogOptions { return LogOptions::defaults() ->logAll() ->logOnlyDirty() ->dontLogEmptyChanges(); } protected function formattedBaseSalary(): Attribute { return Attribute::make( get: fn () => 'Rp '.number_format($this->base_salary, 0, ',', '.'), ); } protected function employmentStatusLabel(): Attribute { return Attribute::make( get: fn () => $this->employment_status->label(), ); } protected function formattedJoinDate(): Attribute { return Attribute::make( get: fn () => $this->join_date?->translatedFormat('l, d F Y'), ); } protected function formattedResignDate(): Attribute { return Attribute::make( get: fn () => $this->resign_date?->translatedFormat('l, d F Y'), ); } #[Scope] protected function contract(Builder $query): void { $query->where('employment_status', EmploymentStatus::CONTRACT); } #[Scope] protected function fullTime(Builder $query): void { $query->where('employment_status', EmploymentStatus::FULL_TIME); } #[Scope] protected function internship(Builder $query): void { $query->where('employment_status', EmploymentStatus::INTERNSHIP); } #[Scope] protected function partTime(Builder $query): void { $query->where('employment_status', EmploymentStatus::PART_TIME); } #[Scope] protected function resigned(Builder $query): void { $query->where('employment_status', EmploymentStatus::RESIGNED); } public function attendances(): HasMany { return $this->hasMany(Attendance::class); } public function employeeAdvances(): HasMany { return $this->hasMany(EmployeeAdvance::class); } public function leaveRequests(): HasMany { return $this->hasMany(LeaveRequest::class); } public function payrolls(): HasMany { return $this->hasMany(Payroll::class); } public function user(): BelongsTo { return $this->belongsTo(User::class); } }