<?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',
        'tax', 'shipping_cost', 'shipping_date', 'wear_date',
        'height', 'hip', 'foot', 'safe_pack', 'tabi', 'towel', 'free_options',
        'quantity', 'total_price', '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');
    }


}
