parfum/app/Livewire/Home/Article/Index.php
2025-12-19 21:31:57 +07:00

35 lines
679 B
PHP

<?php
namespace App\Livewire\Home\Article;
use Illuminate\Contracts\View\View;
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): void
{
if ($slug) {
$this->isDetail = true;
$this->slug = $slug;
}
}
public function render(): View
{
return view(
$this->isDetail
? 'livewire.home.article.show'
: 'livewire.home.article.index'
);
}
}