<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    protected $fillable = ['productcategory_id','type_id','unit_id', 'name', 'code', 'quantity', 'stock', 'price', 'status', 'created_by', 'modified_by', 'created_at', 'updated_at'];

    public function type(){
        return $this->belongsTo('App\Models\Type','type_id');
    }
    public function category(){
        return $this->belongsTo('App\Models\Productcategory','productcategory_id');
    }
    public function unit(){
        return $this->belongsTo('App\Models\Unit');
    }
    public function pdetail(){
        return $this->hasMany('App\Models\PurchaseDetail');
    }
}
