<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class OrderDetail extends Model
{
    protected $table = 'order_details';

    protected $fillable = ['id', 'order_id', 'product_id', 'product_detail_id', 'product_name', 'product_image',
                           'order_method', 'discount', 'catalog_price', 'price', 'shipping_cost', 'quantity', 'total_price',
                           'tax', 'possible_delivery_time', 'shipping_specify_date', 'shipping_specify_time', 'construction_areas',
                           'estimated_delivery_date', 'actual_delivery_date', 'actual_delivery_time', 'delivery_status', 'option_size', 'note',
                           'created_at', 'updated_at'];

    public function product() {
        return $this->belongsTo(Product::class, 'product_id', 'id');
    }

    public function product_detail() {
        return $this->belongsTo(ProductDetail::class, 'product_detail_id', 'id')->with('product', 'option_detail');
    }


}
