Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Http\Livewire;
- use Livewire\Component;
- use Cart;
- class CartComponent extends Component
- {
- public int $qty = 0;
- public function increaseQuantity($rowId)
- {
- $product = Cart::get($rowId);
- $qty = $product->qty + 1;
- Cart::update($rowId, $qty);
- }
- public function decreaseQuantity($rowId)
- {
- $product = Cart::get($rowId);
- $qty = $product->qty - 1;
- Cart::update($rowId, $qty);
- }
- public function render()
- {
- return view('livewire.cart-component')->layout('_layouts.master');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement