parfum/app/Livewire/Home/Article/Index.php

32 lines
629 B
PHP

<?php
namespace App\Livewire\Home\Article;
use Livewire\Attributes\Layout;
use Livewire\Component;
#[Layout('components.layouts.home', [
'title' => 'Article',
])]
class Index extends Component
{
public bool $isDetail = false;
public ?string $slug = null;
public function mount(?string $slug = null)
{
if ($slug) {
$this->isDetail = true;
$this->slug = $slug;
}
}
public function render()
{
return view(
$this->isDetail
? 'livewire.home.article.show'
: 'livewire.home.article.index'
);
}
}