Backflow.php 934 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace App\Models;
  3. /**
  4. * @property $date
  5. * @property $recharge_amount
  6. * @property $withdrawal_amount
  7. * @property $status
  8. * @property $backflow_ratio
  9. * @property $member_id
  10. * @property $amount
  11. * @property $grant_time
  12. *
  13. */
  14. class Backflow extends BaseModel
  15. {
  16. protected $table = 'backflow';
  17. protected $fillable = ['date', 'member_id', 'grant_time', 'recharge_amount', 'withdrawal_amount', 'backflow_ratio', 'amount', 'status',
  18. 'loss_amount', 'details', 'need_flow'];
  19. protected $casts = ['details' => 'array'];
  20. function user()
  21. {
  22. return $this->belongsTo(User::class, 'member_id', 'member_id')
  23. ->select(['id', 'member_id', 'username', 'first_name', 'admin_note', 'status', 'phone', 'visitor_id', 'register_ip']);
  24. }
  25. protected function getGrantTimeAttribute($value): string
  26. {
  27. if ($value > 0) return date('Y-m-d H:i', $value);
  28. return "";
  29. }
  30. }