$this->id, 'responsible_user_id' => $this->responsible_user_id, 'name' => $this->name, 'kinship' => $this->kinship, 'status' => $this->status, 'document_name' => $this->document_name, 'document_is_image' => $this->document_path ? in_array( strtolower(pathinfo($this->document_path, PATHINFO_EXTENSION)), ['jpg', 'jpeg', 'png', 'webp'], true, ) : false, 'document_url' => $this->document_path ? Storage::disk('s3')->temporaryUrl($this->document_path, now()->addHours(24)) : null, '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'), ]; } }