<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class BoxOrderLine extends Model
{
    protected $table = 'box_order_lines';

    protected $primaryKey = 'id';

    protected $fillable = [
        'box_order_id','box_product_variant_id','user_subscription_id','price','quantity','discount_id','subtotal','vat','total'
    ];

    protected $with = ['discount'];

    public function box_order(){
        return $this->belongsTo("App\BoxOrder","box_order_id");
    }

    public function box_product_variant(){
        return $this->belongsTo("App\BoxProductVariant","box_product_variant_id");
    }

    public function discount(){
        return $this->hasOne("App\Discount","id","discount_id");
    }

    public function user_subscription() {
        return $this->hasOne("App\UserSubscription");
    }
}
