<?php

namespace App\Models;

use Illuminate\Database\Eloquent\SoftDeletes;
use Slowlyo\OwlAdmin\Models\BaseModel as Model;

/**
 * 代理商
 */
class AgentInfo extends Model
{
	use SoftDeletes;

	protected $table = 'agent_infos';

    /**
     * @Author FelixYin
     * @description 代理商所属会员
     */
    public function member()
    {
        return $this->belongsTo('App\Models\MemberUser', 'user_id');
    }

    /**
     * @Author FelixYin
     * @description 代理商关联信息认证
     */
    public function info()
    {
        return $this->hasOne('App\Models\AgentInfoRecord', 'id', 'info_record_id');
    }

    /**
     * @Author FelixYin
     * @description 代理商关联实名认证信息
     */
    public function realAuth()
    {
        return $this->hasOne('App\Models\AgentRealAuthRecord', 'id', 'real_auth_record_id');
    }

    /**
     * @Author FelixYin
     * @description 代理商开通项目分类
     */
    public function cates()
    {
        return $this->hasMany('App\Models\AgentProjectCate', 'agent_id', 'id');
    }

    /**
     * @Author FelixYin
     * @description 代理商开通服务项目
     */
    public function projects()
    {
        return $this->hasMany('App\Models\AgentProject', 'id');
    }

    /**
     * @Author FelixYin
     * @description 代理商关联信息认证记录
     */
    public function infoRecords()
    {
        return $this->hasMany('App\Models\AgentInfoRecord', 'agent_id', 'id');
    }

    /**
     * @Author FelixYin
     * @description 代理商关联实名认证记录
     */
    public function realAuthRecords()
    {
        return $this->hasMany('App\Models\AgentRealAuthRecord', 'agent_id', 'id');
    }
}