<?php

namespace App\Http\Controllers;

use App\Models\ContentPage;
use App\Support\SeoMeta;
use Illuminate\View\View;

class ContentPageController extends Controller
{
    public function show(ContentPage $page): View
    {
        abort_if(! $page->is_active, 404);

        return view('content-pages.show', [
            'page' => $page,
            'seo' => SeoMeta::make(
                $page->meta_title ?: $page->title,
                $page->meta_description,
                $page->ogImageUrl(),
            ),
        ]);
    }
}
