<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;

class OldOrders extends Model
{
    protected $connection = 'old_izyim_db';

    protected $table = 'orders';

    /**
     * @return hasOne
     */
    public function address(): hasOne
    {
        return $this->hasOne(OldAddress::class,  'id', 'address_id')->where('type', '=', 1);
    }

    /**
     * @return belongsTo
     */
    public function company(): belongsTo
    {
        return $this->belongsTo(OldCompany::class,  'company_id');
    }

}
