UserDataModifyLog.php 775 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  5. /**
  6. * 用户流量变动记录.
  7. */
  8. class UserDataModifyLog extends Model
  9. {
  10. public const UPDATED_AT = null;
  11. protected $table = 'user_data_modify_log';
  12. // 关联账号
  13. public function user(): BelongsTo
  14. {
  15. return $this->belongsTo(User::class);
  16. }
  17. // 关联订单
  18. public function order(): BelongsTo
  19. {
  20. return $this->belongsTo(Order::class);
  21. }
  22. public function getBeforeAttribute($value)
  23. {
  24. return $this->attributes['before'] = flowAutoShow($value);
  25. }
  26. public function getAfterAttribute($value)
  27. {
  28. return $this->attributes['after'] = flowAutoShow($value);
  29. }
  30. }