$this->id, 'body' => $this->body, 'user_id' => $this->user_id, 'user' => new UserResource($this->whenLoaded('user')), 'commentable_id' => $this->commentable_id, 'commentable_type' => $this->commentable_type, 'files' => FileResource::collection($this->whenLoaded('files')), 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; } }