laravel 5.4:方法[mergeRules]不存在。

时间:2017-07-01 17:35:06

标签: php laravel laravel-5.4

我曾经使用mergeRules

链接我的验证规则
$validation = \Validator::make($request->all(), $myrules_1 );
if ($validation->fails())
exit("error1");

$validation->mergeRules($myrules_2);
if($validation->fails())
exit("error2");

但升级到5.4后我收到此错误

BadMethodCallException in Validator.php line 1096:
 Method [mergeRules] does not exist.
发生了什么?我发现这引用了这个问题,但我无法弄清楚答案是什么!

https://github.com/laravel/framework/issues/17646

1 个答案:

答案 0 :(得分:3)

改为使用addRules

/**
 * Parse the given rules and merge them into current rules.
 *
 * @param  array  $rules
 * @return void
 */
public function addRules($rules)