<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Agency extends BaseModel
{
    use HasFactory;

    public function partner()
    {
        return $this->hasOne(Partner::class, 'id', 'partner_id');
    }

    public function orders()
    {
        return $this->hasMany(Order::class);
    }

    public function quota(){
        return $this->hasOne(Quota::class, 'agency_id', 'id');
    }

    public function agencyUser(){
        return $this->hasOne(AgencyUser::class, 'agency_id', 'id')->where('is_leader',1);
    }
}
