Stelle das U0-Fundament mit CMS, Mitgliedern und Filament bereit.
Deploy Test / test (push) Successful in 2m25s
Deploy Test / deploy (push) Failing after 25s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-15 08:32:14 +01:00
1 parent 89b35ac480
commit 2035c46edd
130 files changed
+18519 -50

No files matched your search

+55
View File
@@ -0,0 +1,55 @@
<?php
namespace App\Http\Controllers;
use App\Domain\Cms\Page;
use App\Domain\Cms\PageRevision;
use Illuminate\Contracts\View\View;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Gate;
class PageController extends Controller
{
public function home(): View
{
return $this->render(Page::query()->where('path', '/')->firstOrFail(), preview: false);
}
public function show(string $path): View
{
return $this->render(Page::query()->where('path', '/'.$path)->firstOrFail(), preview: false);
}
public function preview(PageRevision $revision): View
{
$page = $revision->page;
Gate::authorize('view', $page);
return $this->render($page, preview: true, revision: $revision);
}
public function sitemap(): Response
{
$pages = Page::query()->whereNotNull('published_revision_id')->orderBy('path')->get();
return response()
->view('public.sitemap', ['pages' => $pages])
->header('Content-Type', 'application/xml');
}
private function render(Page $page, bool $preview, ?PageRevision $revision = null): View
{
$revision ??= $page->publishedRevision;
abort_if($revision === null, 404);
$heading = collect($revision->blocks)->firstWhere('type', 'heading');
return view('public.page', [
'page' => $page,
'revision' => $revision,
'preview' => $preview,
'documentTitle' => $revision->seo_title ?: ($heading['heading'] ?? config('app.name')),
'documentDescription' => $revision->seo_description,
]);
}
}