LiveChatModel.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2017~2021 LARAVEL研发中心
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://www.laravel.cn
  8. // +----------------------------------------------------------------------
  9. // | Author: laravel开发员 <laravel.qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace App\Models;
  12. /**
  13. * 直播聊天-模型
  14. * @author laravel开发员
  15. * @since 2020/11/11
  16. * @package App\Models
  17. */
  18. class LiveChatModel extends BaseModel
  19. {
  20. // 设置数据表
  21. protected $table = 'live_chat';
  22. /**
  23. * 发送用户
  24. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  25. */
  26. public function from()
  27. {
  28. return $this->hasOne(MemberModel::class, 'id','from_user_id')
  29. ->select(['id','nickname','avatar','status']);
  30. }
  31. /**
  32. * 接收用户
  33. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  34. */
  35. public function to()
  36. {
  37. return $this->hasOne(MemberModel::class, 'id','to_user_id')
  38. ->select(['id','nickname','avatar','status']);
  39. }
  40. }