<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;

class OfflineOrder extends BaseModel
{
    protected $table = 'partner_offline_orders';

    public function main_order()
    {
        return $this->belongsTo(Order::class,'order_id','id');
    }

    public function partner()
    {
        return $this->belongsTo(Partner::class);
    }

    public function order_commission(){
        return $this->hasMany(OrderCommission::class,'order_id','order_id');
    }

    public function agency()
    {
        return $this->belongsTo(Partner::class,'agency_id','id');
    }

    public function agreement()
    {
        return $this->hasOne(Agreement::class, 'order_id', 'order_id');
    }
}
