<?php

namespace App\Models;

use Illuminate\Database\Eloquent\SoftDeletes;
use Slowlyo\OwlAdmin\Models\BaseModel as Model;

/**
 * 钱包交易记录
 */
class WalletTransRecord extends Model
{
	use SoftDeletes;

	protected $table = 'wallet_trans_records';

    /**
     * @Author FelixYin
     * @description 交易记录所属钱包
     */
    public function wallet()
    {
        return $this->belongsTo('App\Models\Wallet', 'wallet_id');
    }

    /**
     * @Author FelixYin
     * @description 钱包交易关联提现记录
     */
    public function withdraw()
    {
        return $this->hasOne('App\Models\WalletWithdrawRecord', 'trans_record_id', 'id');
    }

    /**
     * @Author FelixYin
     * @description 交易关联支付记录
     */
    public function paymentRecords()
    {
        return $this->hasMany('App\Models\WalletPaymentRecord', 'trans_record_id', 'id');
    }

    /**
     * @Author FelixYin
     * @description 交易关联退款记录
     */
    public function refundRecords()
    {
        return $this->hasMany('App\Models\WalletRefundRecord', 'trans_record_id', 'id');
    }
}