Withdraw.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Withdraw extends Model
  5. {
  6. protected $fillable = ['user_id', 'type', 'bank_name', 'name', 'number', 'state', 'amount', 'procedure', 'practical_amount', 'not_desc', 'created_at', 'updated_at'];
  7. protected $table = 'withdraw';
  8. public static $label = [1 => '微信余额', 2 => '支付宝', 3 => '银行卡'];
  9. public static $state = [0 => '待审核', 1 => '已提现', 2 => '已拒绝'];
  10. public function getCreatedAtAttribute($value)
  11. {
  12. $dateTime = new \DateTime($value);
  13. // 格式化时间
  14. $formattedTime = $dateTime->format('Y-m-d H:i:s');
  15. return $formattedTime;
  16. }
  17. public function getUpdatedAtAttribute($value)
  18. {
  19. $dateTime = new \DateTime($value);
  20. // 格式化时间
  21. $formattedTime = $dateTime->format('Y-m-d H:i:s');
  22. return $formattedTime;
  23. }
  24. public function userData()
  25. {
  26. return $this->hasOne(User::class, 'id', 'user_id');
  27. }
  28. }