1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- namespace App\Models;
- /**
- * 直播聊天-模型
- * @author laravel开发员
- * @since 2020/11/11
- * @package App\Models
- */
- class LiveChatModel extends BaseModel
- {
- // 设置数据表
- protected $table = 'live_chat';
- /**
- * 发送用户
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function from()
- {
- return $this->hasOne(MemberModel::class, 'id','from_user_id')
- ->select(['id','nickname','avatar','status']);
- }
- /**
- * 接收用户
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function to()
- {
- return $this->hasOne(MemberModel::class, 'id','to_user_id')
- ->select(['id','nickname','avatar','status']);
- }
- }
|