<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    protected $fillable = [
        'name',
        'code',
        'hsn_code',
        'gst',
        'price',
        'production_qty',
        'stock',
    ];

   public function materials()
{
    return $this->belongsToMany(
        Material::class,
        'product_material'
    )->withPivot('quantity')
     ->withTimestamps();
}

public function productions()
{
    return $this->hasMany(Production::class);
}
}