<?php

namespace App\Http\Controllers\Frontend;

use App\Http\Controllers\Controller;
use App\Models\Page;

class PageController extends Controller
{
    public function show($slug)
    {
        $page = Page::where('slug', $slug)->firstOrFail();

        $pageHeader = [
            'title' => $page->title,
            'subtitle' => $page->subtitle ?? '',
            'breadcrumbs' => [
                ['label' => __('general.Home'), 'url' => url('/')],
                ['label' => $page->title],
            ]
        ];

        return view('theme::pages.page', compact('page', 'pageHeader'));
    }
}
