ChatList.php 794 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App\Models;
  3. use Dcat\Admin\Traits\HasDateTimeFormatter;
  4. use Illuminate\Database\Eloquent\Model;
  5. class ChatList extends Model
  6. {
  7. use HasDateTimeFormatter;
  8. protected $table = 'chat_list';
  9. protected $fillable = ['user_id', 'to_user_id','last_msg','last_time','atime','un_read'];
  10. public $timestamps = false;
  11. public function user()
  12. {
  13. return $this->belongsTo(User::class,'user_id','id');
  14. }
  15. public function user_info()
  16. {
  17. return $this->belongsTo(UserInfoModel::class,'user_id','user_id');
  18. }
  19. public function to_user()
  20. {
  21. return $this->belongsTo(User::class,'to_user_id','id');
  22. }
  23. public function to_user_info()
  24. {
  25. return $this->belongsTo(UserInfoModel::class,'to_user_id','user_id');
  26. }
  27. }