<?php

namespace App\Livewire;

use Livewire\Component;

class Page extends Component
{
    public $slug;

    public function mount($slug)

    {
        $this->slug = $slug;
    }

    public function render()
    {
        $page = \App\Models\Page::where('slug', $this->slug)->firstOrFail();

        if ($page->is_published == false ) {
            abort(404);
        }
        return view('livewire.page', [
            'page' => $page,
        ]);
    }
}
