UserCreditLog.php 629 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace App\Models;
  3. use App\Casts\money;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  6. /**
  7. * 账号余额操作日志.
  8. */
  9. class UserCreditLog extends Model
  10. {
  11. public const UPDATED_AT = null;
  12. protected $table = 'user_credit_log';
  13. protected $casts = ['before' => money::class, 'after' => money::class, 'amount' => money::class];
  14. protected $guarded = [];
  15. public function user(): BelongsTo
  16. {
  17. return $this->belongsTo(User::class);
  18. }
  19. public function order(): BelongsTo
  20. {
  21. return $this->belongsTo(Order::class);
  22. }
  23. }