$this->id, 'title' => $this->title, 'description' => $this->description, 'category_id' => $this->category_id, 'category' => new CategoryResource($this->whenLoaded('category')), 'questions' => QuestionResource::collection($this->whenLoaded('questions')), 'author_id' => $this->author_id, 'author' => new UserResource($this->whenLoaded('author')), 'closed_at' => $this->closed_at, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; } }