2
我想在laravel5表單驗證錯誤消息中設置自定義的提交名稱。在laravel5表單驗證中爲字段設置自定義驗證消息?
我form validation request class
是,
class PasswordRequest extends Request {
protected $rules = [
'old' => ['required'],
'new' => ['required','same:cnew'],
'cnew' => ['required']
];
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize() {
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules() {
return $this->rules;
}
}
這裏的時候,老,新和cnew emty,錯誤信息會像下面,需要
- 老場。
- 新字段是必填字段。
- 需要cnew字段。需要
我想顯示像下面而不是上面的消息,
- 舊密碼字段
- 新密碼字段需要
- 確認密碼字段是必需的。
如何在laravel5 Form Request Validation方法中可能?
這是需要的,謝謝:) – gsk