这个laravel的语法错误怎么写才对?

用laravel5.2自带的注册表单,给它添加一个验证码项,和原表单一起提交验证,控制器的验证方法原来是这样的:

protected function validator(array $data)
{
    return Validator::make($data, [
        'name' => 'required|max:255',
        'email' => 'required|email|max:255|unique:users',
        'password' => 'required|confirmed|min:6',        
    ]);
}

因为增加了一项验证码,所以变成这样:
1、加了一个Request $request参数;
2、加了一行代码$verification_code_session = $request->session()->get('verification_code', '');)

protected function validator(array $data,Request $request)
{
    $verification_code_session = $request->session()->get('verification_code', '');

    return Validator::make($data, [
        'name' => 'required|max:255',
        'email' => 'required|email|max:255|unique:users',
        'password' => 'required|confirmed|min:6',
        'verification_code' => 'required|in:' . $verification_code_session
    ]);

错误信息如下:

Type error: Argument 2 passed to App\Http\Controllers\Auth\AuthController::validator() must be an instance of Illuminate\Http\Request, none given, called in D:\wnmp\www\laravel-entrust\vendor\laravel\framework\src\Illuminate\Foundation\Auth\RegistersUsers.php on line 69

总之就是参数语法不对之类的问题,不知道语法怎么写,大神帮看一下。

查看回复