Backflow.php 778 B

1234567891011121314151617181920212223242526272829303132
  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. function user()
  19. {
  20. return $this->belongsTo(User::class, 'member_id', 'member_id')
  21. ->select(['id', 'member_id', 'username', 'first_name']);
  22. }
  23. protected function getGrantTimeAttribute($value): string
  24. {
  25. if ($value > 0) return date('Y-m-d H:i', $value);
  26. return "";
  27. }
  28. }