Created
August 1, 2016 10:11
-
-
Save taisang1996/c9aff205d344e18fc995e77ad5b51723 to your computer and use it in GitHub Desktop.
Tùy chỉnh thông báo (messages) validation AuthController trên Laravel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// app/Http/Controllers/Auth/AuthController.php | |
protected function validator(array $data) | |
{ | |
// Validator::make( array $data, array $rules, array $messages = array(), array $customAttributes = array()) | |
return Validator::make($data, [ | |
'name' => 'required|max:255', | |
'email' => 'required|email|max:255|unique:users', | |
'password' => 'required|min:6|confirmed', | |
], [ | |
'name.required' => 'Vui lòng nhập Tên', | |
'name.max' => 'Tên tối đa :max ký tự', | |
'email.required' => 'Vui lòng nhập Email', | |
'email.email' => 'Email bạn nhập không hợp lệ', | |
'email.max' => 'Email tối đã :max ký tự', | |
'email.unique' => 'Email này đã tồn tại trong hệ thống', | |
/// ... more here | |
]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment