__('Type single'), 'group' => __('Type group'), 'service' => __('Type service')]; } public function getTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['type']) ? $data['type'] : ''); $list = $this->getTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getChatInfoAttr($value, $data) { $info = false; if ($data['type'] == 'group') { $info = Common::getImGroupChat($data['chat_id']); } elseif ($data['type'] == 'service') { $info = \think\Db::name('fastim_service')->where('id', $data['chat_id'])->find(); } return $info; } public function user() { return $this->belongsTo('app\admin\model\fastim\User', 'user_one', 'id', [], 'LEFT')->setEagerlyType(0); } public function usertwo() { return $this->belongsTo('app\admin\model\fastim\User', 'user_two', 'id', [], 'LEFT')->setEagerlyType(0); } }