'json' ]; protected $append = [ 'platform_text', 'from_text' ]; public function getPlatformTextAttr($value, $data) { $value = $value ?: ($data['platform'] ?? null); return ShareEnum::getPlatformText($value); } public function getFromTextAttr($value, $data) { $value = $value ?: ($data['from'] ?? null); return ShareEnum::getFromText($value); } // -- commission code start -- public function agent() { return $this->belongsTo(\app\common\model\commission\Agent::class, 'share_id', 'user_id'); } // -- commission code end -- public function user() { return $this->belongsTo(UserModel::class, 'user_id', 'id'); } }