<?php

namespace App\Models\Virtual;

use App\Models\CompanyBase;

/**
 * App\Models\Virtual\Agent
 *
 * @property int $id 机构ID
 * @property int $company_id 企业ID
 * @property string $sn 机构编号
 * @property string $name 机构名称
 * @property string $contacts 联系人
 * @property string $mobile 手机号
 * @property string $address 地址
 * @property string|null $remark 订单备注
 * @property array|null $extends 扩展信息
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property \Illuminate\Support\Carbon|null $deleted_at
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Virtual\CompanyAccount[] $accounts
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Virtual\CompanyAddress[] $addresses
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Virtual\Company newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Virtual\Company newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Virtual\Company query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Virtual\Company whereAddress($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Virtual\Company whereContacts($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Virtual\Company whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Virtual\Company whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Virtual\Company whereExtends($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Virtual\Company whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Virtual\Company whereMobile($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Virtual\Company whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Virtual\Company whereRemark($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Virtual\Company whereSn($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Virtual\Company whereUpdatedAt($value)
 * @mixin \Eloquent
 * @property int $status 状态 0:正常 1:禁用
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Virtual\Company whereStatus($value)
 */
class Agent extends CompanyBase
{
    protected $table = 'virtual_agents';

    protected $fillable = ['id', 'company_id','sn', 'name' , 'contacts', 'mobile', 'address', 'remark', 'extends', 'status'];

    protected $casts = [
        'extends' => 'array',
    ];

    public function company()
    {
        return $this->belongsTo(Company::class, 'company_id', 'id');
    }
}
