User.php 679 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\admin\model\shopro\chat;
  3. use app\admin\model\shopro\Common;
  4. use app\admin\model\shopro\user\User as ShopUser;
  5. class User extends Common
  6. {
  7. protected $name = 'shopro_chat_user';
  8. // 自动数据类型转换
  9. protected $type = [
  10. 'last_time' => 'timestamp',
  11. ];
  12. public function customer()
  13. {
  14. return $this->morphMany(Record::class, ['sender_identify', 'sender_id'], 'customer');
  15. }
  16. public function user()
  17. {
  18. return $this->belongsTo(ShopUser::class, 'auth_id');
  19. }
  20. public function customerService()
  21. {
  22. return $this->belongsTo(CustomerService::class, 'customer_service_id');
  23. }
  24. }