'date', 'new_start_date' => 'date', 'new_end_date' => 'date', 'approved_at' => 'datetime', 'new_allowances' => 'array', 'new_benefits' => 'array', 'new_basic_salary' => 'decimal:2', ]; public function contract() { return $this->belongsTo(EmployeeContract::class); } public function requester() { return $this->belongsTo(User::class, 'requested_by'); } public function approver() { return $this->belongsTo(User::class, 'approved_by'); } public function creator() { return $this->belongsTo(User::class, 'created_by'); } public function getNewTotalCompensationAttribute() { $total = $this->new_basic_salary; if ($this->new_allowances && is_array($this->new_allowances)) { foreach ($this->new_allowances as $allowance) { $total += $allowance['amount'] ?? 0; } } return $total; } }