User.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace App\Models;
  3. use App\Constants\HttpStatus;
  4. use App\Constants\Util;
  5. use Illuminate\Foundation\Auth\User as Authenticatable;
  6. use Illuminate\Notifications\Notifiable;
  7. use Laravel\Sanctum\HasApiTokens;
  8. use Illuminate\Database\Eloquent\Builder;
  9. /**
  10. * @mixin Builder
  11. * @method static Builder|static where($column, $operator = null, $value = null, $boolean = 'and')
  12. * @property mixed $id
  13. * @property mixed $member_id
  14. * @property mixed $username
  15. * @property mixed $first_name
  16. */
  17. class User extends Authenticatable
  18. {
  19. use HasApiTokens, Notifiable;
  20. protected $table = 'users';
  21. protected $hidden = ['created_at', 'updated_at'];
  22. protected $fillable = ['usdt', 'member_id', 'first_name', 'game_id', 'username', 'secret_key', 'secret_pass'];
  23. public function wallet()
  24. {
  25. return $this->belongsTo(Wallet::class, 'id', 'user_id');
  26. }
  27. public function getMemberId()
  28. {
  29. return $this->member_id;
  30. }
  31. public function getUsername()
  32. {
  33. return $this->username;
  34. }
  35. public function getFirstName(){
  36. return $this->first_name;
  37. }
  38. protected function getCreatedAtAttribute($value)
  39. {
  40. return \Carbon\Carbon::parse($value)->setTimezone('Asia/Shanghai')->format('Y-m-d H:i:s');
  41. }
  42. protected function getUpdatedAtAttribute($value)
  43. {
  44. return \Carbon\Carbon::parse($value)->setTimezone('Asia/Shanghai')->format('Y-m-d H:i:s');
  45. }
  46. }