<?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');
    }
}
