*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'title' => $this->title, 'slug' => $this->slug, 'description' => $this->description, 'thumbnail_url' => $this->thumbnail_path ? asset('storage/'.$this->thumbnail_path) : null, 'category' => new CategoryResource($this->whenLoaded('category')), 'keys' => TemplateKeyResource::collection($this->whenLoaded('keys')), ]; } }