User.php 977 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace App\Models;
  3. use DateTimeInterface;
  4. use Illuminate\Database\Eloquent\Factories\HasFactory;
  5. use Illuminate\Database\Eloquent\Model;
  6. use Illuminate\Database\Eloquent\SoftDeletes;
  7. class User extends Model
  8. {
  9. use HasFactory,SoftDeletes;
  10. protected $table = 'user';
  11. public $timestamps = FALSE;
  12. const DELETED_AT = 'delete_time';
  13. protected $dateFormat = 'U';
  14. protected $hidden = [
  15. 'user_pass'
  16. ];
  17. protected function serializeDate(DateTimeInterface $date): string
  18. {
  19. return $date->format('Y-m-d H:i:s');
  20. }
  21. // 技师信息
  22. public function artificer()
  23. {
  24. return $this->hasOne(Artificer::class, 'user_id', 'id')->select('id', 'user_id', 'name', 'avatar', 'phone','apply_num','js_status','identity','certificates','pictures','work','jianjie');
  25. }
  26. // 分销等级
  27. public function distributor()
  28. {
  29. return $this->hasOne(Distributor::class, 'id', 'distributor_id');
  30. }
  31. }