Wallet.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 Wallet extends Model
  9. {
  10. use SoftDeletes;
  11. protected $table = 'wallet';
  12. protected $fillable = [
  13. 'owner_type', // 添加这一行以允许 mass assignment
  14. ];
  15. /**
  16. * @Author FelixYin
  17. * @description 钱包交易记录
  18. */
  19. public function transRecords()
  20. {
  21. return $this->hasMany('App\Models\WalletTransRecord', 'wallet_id', 'id');
  22. }
  23. /**
  24. * @Author FelixYin
  25. * @description 钱包关联提现记录
  26. */
  27. public function withdrawRecords()
  28. {
  29. return $this->hasMany('App\Models\WalletWithdrawRecord', 'wallet_id', 'id');
  30. }
  31. /**
  32. * @Author FelixYin
  33. * @description 钱包所属会员
  34. */
  35. public function member()
  36. {
  37. return $this->belongsTo('App\Models\MemberUser', 'owner_id');
  38. }
  39. /**
  40. * @Author FelixYin
  41. * @description 钱包关联退款记录
  42. */
  43. public function refundRecords()
  44. {
  45. return $this->hasMany('App\Models\WalletRefundRecord', 'wallet_id', 'id');
  46. }
  47. }