<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class BillProduct extends Model
{
    protected $table = 'bill_products';
    protected $primaryKey = 'bill_products_id';
    protected $fillable = [
        'bill_id',
        'bill_number',
        'product_id',
        'product_code',
        'category_id',
        'brand_id',
        'color_id',
        'size_id',
        'style_id',
        'product_quantity',
        'product_price',
        'product_total',
        'status',
    ];
    protected $hidden = [
        'created_at',
        'updated_at',
    ];

    public function category() {
        return $this->hasMany('App\Models\Categories', 'category_id', 'category_id')->select('category_id', 'category_name');
    }

    public function brand() {
        return $this->hasMany('App\Models\Brand', 'brand_id', 'brand_id')->select('brand_id', 'brand_name');
    }

    public function color() {
        return $this->hasMany('App\Models\Color', 'color_id', 'color_id')->select('color_id', 'color_name');
    }

    public function size() {
        return $this->hasMany('App\Models\Size', 'size_id', 'size_id')->select('size_id', 'size_name');
    }

    public function style() {
        return $this->hasMany('App\Models\Style', 'style_id', 'style_id')->select('style_id', 'style_name');
    }

    public function bills() {
        return $this->hasMany('App\Models\Bill', 'bills_id', 'bills_id');
    }
}
