UserDataModifyLog.php 804 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. protected $guarded = [];
  13. // 关联账号
  14. public function user(): BelongsTo
  15. {
  16. return $this->belongsTo(User::class);
  17. }
  18. // 关联订单
  19. public function order(): BelongsTo
  20. {
  21. return $this->belongsTo(Order::class);
  22. }
  23. public function getBeforeAttribute($value)
  24. {
  25. return $this->attributes['before'] = flowAutoShow($value);
  26. }
  27. public function getAfterAttribute($value)
  28. {
  29. return $this->attributes['after'] = flowAutoShow($value);
  30. }
  31. }