<?php

use App\Models\{Product, Review};
use Livewire\Attributes\Layout;
use Livewire\Component;
use App\Concerns\WishListTrait;
use Illuminate\Support\Facades\Auth;

return new class extends Component
{
    #[Layout('layouts.store')]

    public Product $product;
    public $selectedVariantId;
    public $rating = 5;
    public $comment = '';
    public $products, $key;
    public $qty = 1;
    use WishListTrait; 

    public function mount($slug)
    {
        $this->product = Product::with('category')->where('slug', $slug)->firstOrFail();
        $this->products = Product::with('category')->where('category_id', $this->product->category_id)->get();
        $this->qty;
    }

    public function increaseQty(){
        $this->qty++;
    }

    public function decreaseQty()
    {
         if ($this->qty > 1) {
            $this->qty--;
        }
    }

    protected function view($data = [])
    {
        return app('view')->file('C:\laragon\www\ecommerce\storage\framework/views/livewire/views/7aad509d.blade.php', $data);
    }

    public function scriptModuleSrc()
    {
        return 'C:\laragon\www\ecommerce\storage\framework/views/livewire/scripts/7aad509d.js';
    }
};
