$this->id, 'responsible_user_id' => $this->responsible_user_id, 'name' => $this->name, 'kinship' => $this->kinship, 'status' => $this->status, 'responsible_user' => $this->whenLoaded('responsibleUser', fn() => [ 'id' => $this->responsibleUser->id, 'name' => $this->responsibleUser->name, 'position' => $this->responsibleUser->relationLoaded('position') ? $this->responsibleUser->position?->name : null, 'sector' => $this->responsibleUser->relationLoaded('sector') ? $this->responsibleUser->sector?->name : null, ]), 'created_at' => Carbon::parse($this->created_at)->format('Y-m-d H:i:s'), 'updated_at' => Carbon::parse($this->updated_at)->format('Y-m-d H:i:s'), ]; } }