<?php

namespace addons\webman\model;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

/**
 * Class ChannelRechargeMethodLang
 * @property int id 主键
 * @property string lang 语言标识
 * @property string name 姓名
 * @property int method_id 充值方式
 * @property string bank_name 银行
 * @property string sub_bank 支行
 * @property string owner 户名
 *
 * @property ChannelRechargeMethod rechargeMethod
 * @package addons\webman\model
 */
class ChannelRechargeMethodLang extends Model
{
    public $timestamps = false;
    protected $fillable = ['lang', 'name', 'method_id', 'bank_name', 'sub_bank', 'owner'];
    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);

        $this->setTable(plugin()->webman->config('database.channel_recharge_method_lang_table'));
    }

    /**
     * 充值方式
     * @return BelongsTo
     */
    public function rechargeMethod(): BelongsTo
    {
        return $this->belongsTo(plugin()->webman->config('database.channel_recharge_method_model'), 'method_id')->withTrashed();
    }
}
