ReferralApply.php 924 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace App\Http\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. /**
  5. * 返利申请
  6. * Class ReferralApply
  7. *
  8. * @package App\Http\Models
  9. */
  10. class ReferralApply extends Model
  11. {
  12. protected $table = 'referral_apply';
  13. protected $primaryKey = 'id';
  14. public function User()
  15. {
  16. return $this->hasOne(User::class, 'id', 'user_id');
  17. }
  18. function getBeforeAttribute($value)
  19. {
  20. return $value / 100;
  21. }
  22. function setBeforeAttribute($value)
  23. {
  24. $this->attributes['before'] = $value * 100;
  25. }
  26. function getAfterAttribute($value)
  27. {
  28. return $value / 100;
  29. }
  30. function setAfterAttribute($value)
  31. {
  32. $this->attributes['after'] = $value * 100;
  33. }
  34. function getAmountAttribute($value)
  35. {
  36. return $value / 100;
  37. }
  38. function setAmountAttribute($value)
  39. {
  40. $this->attributes['amount'] = $value * 100;
  41. }
  42. }