12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace App\Models;
- use Dcat\Admin\Traits\HasDateTimeFormatter;
- use Illuminate\Database\Eloquent\Model;
- class ChatList extends Model
- {
- use HasDateTimeFormatter;
- protected $table = 'chat_list';
- protected $fillable = ['user_id', 'to_user_id','last_msg','last_time','atime','un_read'];
- public $timestamps = false;
- public function user()
- {
- return $this->belongsTo(User::class,'user_id','id');
- }
- public function user_info()
- {
- return $this->belongsTo(UserInfoModel::class,'user_id','user_id');
- }
- public function to_user()
- {
- return $this->belongsTo(User::class,'to_user_id','id');
- }
- public function to_user_info()
- {
- return $this->belongsTo(UserInfoModel::class,'to_user_id','user_id');
- }
- }
|