*/ public function homepage(array $settings): array { // Always provide source collections. Visibility is owned by page placements // in the composable content system; the legacy theme still applies its // existing show_* settings while no composition has been installed. return [ 'pricingPlans' => $this->pricingPlans(), 'testimonials' => $this->testimonials(), 'faqs' => $this->faqs(), 'teamMembers' => $this->team(), 'latestBlogPosts' => $this->blogPosts(), 'latestNewsArticles' => $this->newsArticles(), ]; } private function pricingPlans(): Collection { return $this->query('products', fn () => Product::query() ->where('is_active', true) ->where('product_type', 'plan') ->orderBy('sort_order') ->orderBy('id') ->limit(6) ->get()); } private function testimonials(): Collection { return $this->query('testimonials', fn () => Testimonial::query() ->where('enabled', true) ->latest('id') ->limit(6) ->get()); } private function faqs(): Collection { return $this->query('faqs', fn () => Faq::query() ->where('enabled', true) ->orderBy('sort_order') ->limit(12) ->get()); } private function team(): Collection { return $this->query('team_members', fn () => TeamMember::query() ->where('enabled', true) ->orderBy('sort_order') ->limit(8) ->get()); } private function blogPosts(): Collection { return $this->query('blog_posts', fn () => Blog::query() ->published() ->latest('published_at') ->limit(3) ->get()); } private function newsArticles(): Collection { return $this->query('news_articles', fn () => News::query() ->published() ->latest('published_at') ->limit(3) ->get()); } private function query(string $table, callable $callback): Collection { try { return Schema::hasTable($table) ? $callback() : collect(); } catch (Throwable) { return collect(); } } private function enabled(array $settings, string $key, bool $default): bool { return filter_var($settings[$key] ?? $default, FILTER_VALIDATE_BOOL); } }