UserWithdraw.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * @Name
  4. * @Description
  5. * @Author 刘学玺
  6. * @Date 2023/12/1 18:44
  7. */
  8. namespace App\Models;
  9. use DateTimeInterface;
  10. use Illuminate\Database\Eloquent\Factories\HasFactory;
  11. use Illuminate\Database\Eloquent\Model;
  12. use Illuminate\Database\Eloquent\SoftDeletes;
  13. class UserWithdraw extends Model
  14. {
  15. use HasFactory, SoftDeletes;
  16. protected $table = 'user_tx';
  17. public $timestamps = FALSE;
  18. const DELETED_AT = 'delete_time';
  19. protected $casts = [
  20. 'create_time' => 'datetime'
  21. ];
  22. protected function serializeDate(DateTimeInterface $date): string
  23. {
  24. return $date->format('Y-m-d H:i:s');
  25. }
  26. public function user(): \Illuminate\Database\Eloquent\Relations\HasOne
  27. {
  28. return $this->hasOne(User::class, 'id', 'user_id')->select('id', 'user_type', 'user_nickname', 'avatar', 'mobile', 'balance','user_status','distributor_id');
  29. }
  30. public function admin()
  31. {
  32. return $this->hasOne(Admin::class, 'id', 'admin_id')->select('id', 'name', 'nickname');
  33. }
  34. }