<?php

namespace App\Models\Orders;

use App\Models\ItemDb;
use Illuminate\Database\Eloquent\Model;

class SalesDelivery extends Model
{
    protected $table = 'sale_deliveries';
    protected $fillable = [
        'id',
        'order_id',
        'order_item_id',
        'shipping_provider_id',
        'trackingCode',
        'tracking_print',
        'tracking_label',
        'commits',
        'trackingCodeReturn',
        'trackingPrintReturn',
        'trackingLabelReturn',
        'commitsReturn',
        'created_at',
        'updated_at',
        'status',
        'deliver_date',
        'novelty',
    ];

    public function order()
    {
        return $this->belongsTo(SalesOrder::class);
    }
    public function orderItems()
    {
        return $this->hasMany(SalesOrderDetail::class,'id',"order_item_id");
    }
    public function logistic()
    {
        return $this->belongsTo(ShippingProvider::class, 'shipping_provider_id', 'id');
    }
}
