Pillar::query()->published()->get(), ]); } public function show(string $slug): View { $theme = Pillar::query()->published()->where('slug', $slug)->firstOrFail(); $pages = $theme->pages() ->whereNotNull('published_revision_id') ->with('publishedRevision') ->orderBy('path') ->get(); return view('public.themes.show', [ 'theme' => $theme, 'pages' => $pages, 'documentDescription' => $this->description($theme), ]); } private function description(Pillar $theme): string { $summary = trim((string) $theme->public_summary); $summary = preg_replace('/\s+/', ' ', $summary) ?? ''; if (mb_strlen($summary) <= 160) { return $summary; } return rtrim(mb_substr($summary, 0, 157)).'…'; } }