path(), '/'); $slug = $path === '' ? (string) config('manager.blocks.preview.home', 'home') : $path; abort_unless(preg_match('/^[a-z0-9]+(?:-[a-z0-9]+)*$/', $slug) === 1, 404); $definition = Page::definitions()[$slug] ?? null; $page = Page::query()->where('slug', $slug)->first(); abort_if($definition === null && ($page === null || ! $page->is_published), 404); $blocks = Blocks::for($slug); abort_if($blocks === [], 404); return response()->view((string) config('manager.frontend.layout', 'manager::public.layout'), [ 'title' => $page->title ?? $definition['title'] ?? $slug, 'description' => $page->meta_description ?? null, 'blocks' => $blocks, 'slug' => $slug, 'css' => (string) file_get_contents(__DIR__.'/../../../resources/blocks/blocks.css'), ])->header('Cache-Control', 'private, no-cache'); } }