hasMany(AccountRecord::class, 'relation_id', 'id'); } /** * 是否收藏 * * @return HasOne */ public function collect(): HasOne { return $this->hasOne(AccountRecord::class, 'relation_id', 'id')->bind(['is_collected' => 'is_record']); } /** * 创建人信息 * * @return HasOne */ public function member(): HasOne { return $this->hasOne(Member::class, 'id', 'created_by')->bind(['nickname']); } /** * 分类 * * @return HasOne */ public function category(): HasOne { return $this->hasOne(ArchivesCategory::class, 'id', 'category_id')->bind(['category_title' => 'title']); } }