1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\SoftDeletes;
- use Slowlyo\OwlAdmin\Models\BaseModel as Model;
- /**
- * 钱包
- */
- class Wallet extends Model
- {
- use SoftDeletes;
- protected $table = 'wallet';
- protected $fillable = [
- 'owner_type', // 添加这一行以允许 mass assignment
- ];
- /**
- * @Author FelixYin
- * @description 钱包交易记录
- */
- public function transRecords()
- {
- return $this->hasMany('App\Models\WalletTransRecord', 'wallet_id', 'id');
- }
- /**
- * @Author FelixYin
- * @description 钱包关联提现记录
- */
- public function withdrawRecords()
- {
- return $this->hasMany('App\Models\WalletWithdrawRecord', 'wallet_id', 'id');
- }
- /**
- * @Author FelixYin
- * @description 钱包所属会员
- */
- public function member()
- {
- return $this->belongsTo('App\Models\MemberUser', 'owner_id');
- }
- /**
- * @Author FelixYin
- * @description 钱包关联退款记录
- */
- public function refundRecords()
- {
- return $this->hasMany('App\Models\WalletRefundRecord', 'wallet_id', 'id');
- }
- }
|