Skip to content

Instantly share code, notes, and snippets.

@taisang1996
Created August 1, 2016 10:11
Show Gist options
  • Save taisang1996/c9aff205d344e18fc995e77ad5b51723 to your computer and use it in GitHub Desktop.
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
<?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