18 lines
504 B
PHP
18 lines
504 B
PHP
<?php
|
|
|
|
namespace Modules\Pages\Http\Controllers;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\View\View;
|
|
use Modules\Pages\Models\Page;
|
|
|
|
final class PublicPageController extends Controller
|
|
{
|
|
public function show(string $slug): View
|
|
{
|
|
$page = Page::query()->where('slug', $slug)->where('status', 'published')->where(fn ($q) => $q->whereNull('published_at')->orWhere('published_at', '<=', now()))->firstOrFail();
|
|
|
|
return view('pages::public.show', compact('page'));
|
|
}
|
|
}
|