User.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. */
  13. class User extends Authenticatable
  14. {
  15. use HasApiTokens, Notifiable;
  16. protected $table = 'users';
  17. protected $hidden = ['created_at', 'updated_at'];
  18. protected $fillable = ['usdt', 'member_id', 'first_name', 'game_id'];
  19. public function wallet()
  20. {
  21. return $this->belongsTo(Wallet::class, 'id', 'user_id');
  22. }
  23. protected function getCreatedAtAttribute($value)
  24. {
  25. return \Carbon\Carbon::parse($value)->setTimezone('Asia/Shanghai')->format('Y-m-d H:i:s');
  26. }
  27. protected function getUpdatedAtAttribute($value)
  28. {
  29. return \Carbon\Carbon::parse($value)->setTimezone('Asia/Shanghai')->format('Y-m-d H:i:s');
  30. }
  31. }