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

34 lines
631 B
PHP

<?php
namespace App\Livewire\Home\Product;
use Livewire\Attributes\Layout;
use Livewire\Component;
#[Layout('components.layouts.home', [
'title' => 'Product',
])]
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.product.show'
: 'livewire.home.product.index'
);
}
}