$this->id, 'title' => $this->title, 'description' => $this->description, 'isPublic' => $this->is_public, 'publishedOn' => $this->publication_date ? $this->publication_date->toIso8601String() : null, 'owner' => new UserResource($this->whenLoaded('owner')), // Charge la ressource User si l'owner est chargé ]; } }