我面临着一个问题,laravel定制验证信息,这里是我有的:
$rules = [ 'first_name' => 'required|alpha|min:2','last_name' => 'required|alpha|min:2','email' => 'required|email|unique:users,email,' . Input::get('id') . ',id','password' => 'alpha_num|between:6,12|confirmed','password_confirmation' => 'alpha_num|between:6,12','address' => 'regex:/^[a-z0-9- ]+$/i|min:2','city' => 'alpha|min:2','state' => 'alpha|min:2|max:2','zip' => 'numeric|min:5|max:5','phone' => 'regex:/^\d{3}\-\d{3}\-\d{4}$/',]; $messages = [ 'unique' => 'The :attribute already been registered.','regex' => 'The :attribute number has to be formated : xxx-xxx-xxxx.',];
现在如果地址或电话号码有问题,因为它们都具有正则表达式验证规则,错误信息将是:必须形成:属性号码:xxx-xxx-xxxx,我如何为每个不同的定制消息一个?