<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    protected $table = 'products';

    public $timestamps = false;

    protected $fillable = [
        'store_id',
        'category_id',
        'name',
        'image',
        'gallery',
        'purity',
        'weight',
        'making_charge',
        'price',
        'stock',
        'description'
    ];


    protected $casts = [
        'gallery' => 'array',
    ];
    public function category()
    {
        return $this->belongsTo(Category::class, 'category_id');
    }


    public function store()
    {
        return $this->belongsTo(Store::class);
    }
    public function barcodes()
    {
        return $this->hasMany(ProductBarcode::class, 'product_id');
    }

    public function likedByCustomers()
    {
        return $this->hasMany(CustomerLike::class, 'product_id');
    }
}
