*/ public function toArray(Request $request): array { $companyLogoUrl = null; if (!empty($this->company_logo_path)) { $companyLogoUrl = filter_var($this->company_logo_path, FILTER_VALIDATE_URL) ? $this->company_logo_path : asset('uploads/' . ltrim($this->company_logo_path, '/')); } $imageUrl = null; if (!empty($this->image_path)) { $imageUrl = filter_var($this->image_path, FILTER_VALIDATE_URL) ? $this->image_path : asset('uploads/' . ltrim($this->image_path, '/')); } return [ 'id' => $this->id, 'type' => $this->type, // 'partner' | 'impact' 'content_html' => $this->content_html, 'content_summary' => $this->content_summary, 'author_name' => $this->author_name, 'author_title' => $this->author_title, 'company_name' => $this->company_name, 'company_logo_url' => $companyLogoUrl, 'image_url' => $imageUrl, 'text_position' => $this->text_position ?? 'left', // 'left' | 'right' 'sort' => $this->sort, 'status' => $this->status, 'featured' => (bool) $this->featured, 'published_at' => $this->published_at?->format('Y-m-d H:i:s'), 'created_at' => $this->created_at?->toISOString(), 'updated_at' => $this->updated_at?->toISOString(), ]; } }