Files
Paymenter-Version-Tracks/app/Livewire/Components/Cart.php
Muhammad Tamir b3933b9960 v1.4.0
2025-11-14 10:59:24 +07:00

32 lines
587 B
PHP

<?php
namespace App\Livewire\Components;
use App\Classes\Cart as ClassesCart;
use App\Livewire\Component;
use Livewire\Attributes\On;
class Cart extends Component
{
public $cartCount;
public function mount()
{
$this->cartCount = ClassesCart::items()->count();
if ($this->cartCount === 0) {
$this->skipRender();
}
}
#[On('cartUpdated')]
public function onCartUpdated()
{
$this->cartCount = ClassesCart::items()->count();
}
public function render()
{
return view('components.cart');
}
}