Veröffentliche fachliche Säulen als Themenbereiche der Website.
Dieselbe Liste trägt die öffentliche Seite. Medien bleiben privat, Seiten können mehreren Säulen zugeordnet sein. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
af85a94cd5
commit
8cd382c357
21 files changed
+379
-13
No files matched your search
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Domain\Catalog\Pillar;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class ThemeController extends Controller
|
||||
{
|
||||
public function index(): View
|
||||
{
|
||||
return view('public.themes.index', [
|
||||
'themes' => 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)).'…';
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user