hasOne(Category::class, 'id',"type"); } /** * 关联的平台商 * * @return HasOne */ public function agency(): HasOne { return $this->hasOne(Business::class, 'agency_code', "code"); } public function account() { return $this->hasOne(Account::class, 'business_code',"code"); } public function agency() { return $this->hasOne(self::class,"code","agency_code"); } }