WalletTransRecord.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\SoftDeletes;
  4. use Slowlyo\OwlAdmin\Models\BaseModel as Model;
  5. /**
  6. * 钱包交易记录
  7. */
  8. class WalletTransRecord extends Model
  9. {
  10. use SoftDeletes;
  11. protected $table = 'wallet_trans_records';
  12. protected $guarded = [];
  13. /**
  14. * @Author FelixYin
  15. * @description 交易记录所属钱包
  16. */
  17. public function wallet()
  18. {
  19. return $this->belongsTo(Wallet::class, 'wallet_id', 'id');
  20. }
  21. /**
  22. * @Author FelixYin
  23. * @description 钱包交易关联提现记录
  24. */
  25. public function withdraw()
  26. {
  27. return $this->hasOne(WalletWithdrawRecord::class, 'trans_record_id', 'id');
  28. }
  29. /**
  30. * @Author FelixYin
  31. * @description 交易关联支付记录
  32. */
  33. public function paymentRecords()
  34. {
  35. return $this->hasMany(WalletPaymentRecord::class, 'trans_record_id', 'id');
  36. }
  37. /**
  38. * @Author FelixYin
  39. * @description 交易关联退款记录
  40. */
  41. public function refundRecords()
  42. {
  43. return $this->hasMany(WalletRefundRecord::class, 'trans_record_id', 'id');
  44. }
  45. }