我曾经使用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.
发生了什么?我发现这引用了这个问题,但我无法弄清楚答案是什么!
答案 0 :(得分:3)
改为使用addRules
。
/**
* Parse the given rules and merge them into current rules.
*
* @param array $rules
* @return void
*/
public function addRules($rules)