how to check last data perPage and hide the button load more
class Index extends Component
{
public $perPage = 12;
public function loadMore()
{
$this->perPage = $this->perPage + 12;
}
public function render()
{
$products = Product::latest()->paginate($this->perPage);
return view('livewire.frontend.home.index', [
'products' => $products
]);
}
}
<button wire:click="loadMore()" class="btn btn-dark btn-lg shadow-sm">Load More</button>