<?php
namespace App\Validators;

/**
 * 提现验证器
 */
class WithdrawalsValidator extends BaseValidator {
    //验证规则
    protected $rule =[
        'commission_ids'=>'required',
        'withdrawals_type'=>'required|in:0,1,2',
        'withdrawals_name'=>'required',
        'withdrawals_num'=>'required',
        'status' => 'required|in:1,2,3',
        'pic'=>'required_if:status,1',
        'reason'=>'required_if:status,3',
    ];
    //自定义验证信息
    protected $message = [
        'commission_ids.required' =>'请选择要提现的佣金',
        'withdrawals_type.required'=>'请选择收款方式',
        'withdrawals_type.in'=>'收款方式错误',
        'withdrawals_name.required'=>'请填写收款人姓名',
        'withdrawals_num.required'=>'请填写收款人账号',
        'status.required' => '请选择操作',
        'status.in' => '操作类型错误',
        'pic.required_if' => '请上传打款凭证',
        'reason.required_if' => '请填写拒绝原因',
    ];

    //自定义场景
    protected $scene = [
        'apply' => ['commission_ids','withdrawals_name','withdrawals_num','bill_pic'],
        'act'=>['status','pic','reason'],
    ];
}
