add new validation rule and message for profile update
This commit is contained in:
parent
0c69c2e8a4
commit
0e27f7c130
|
|
@ -20,24 +20,24 @@ public function rules(): array
|
|||
$userId = Auth::id();
|
||||
//tambah validasi
|
||||
return [
|
||||
'nama' => 'required|string|min:3|max:100|regex:/^[a-zA-Z\s]+$/',
|
||||
'username' => 'required|string|alpha_num|max:10|unique:users,username,' . $userId . ',id_user',
|
||||
'nama' => 'required|string|min:3|max:30|regex:/^[a-zA-Z\s]+$/',
|
||||
'username' => 'required|string|alpha_num|min:5|max:10|unique:users,username,' . $userId . ',id_user',
|
||||
'email' => 'required|email|unique:users,email,' . $userId . ',id_user',
|
||||
'no_wa' => 'nullable|numeric|digits_between:10,15',
|
||||
'alamat' => 'nullable|string|max:200|regex:/^[a-zA-Z0-9\s\.,:"-]+$/',
|
||||
'alamat' => 'nullable|string|min:10|max:150|regex:/^[a-zA-Z0-9\s\.\,\/\-\(\)]+$/',
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'required' => 'Kolom :attribute wajib diisi.',
|
||||
'required' => ':attribute wajib diisi.',
|
||||
'unique' => ':attribute sudah digunakan.',
|
||||
'numeric' => ':attribute harus berupa angka.',
|
||||
'email' => 'Format :attribute tidak valid.',
|
||||
'digits_between' => ':attribute harus berjumlah antara 10 sampai 15 digit.',
|
||||
'min' => ':attribute minimal harus berisi :min karakter.',
|
||||
'max' => ':attribute maksimal hanya boleh :max karakter.',
|
||||
'min' => ':attribute terlalu pendek, minimal :min karakter.',
|
||||
'max' => ':attribute terlalu panjang, maksimal :max karakter.',
|
||||
'nama.regex' => 'Nama hanya boleh berisi huruf dan spasi.',
|
||||
'username.alpha_num' => 'Username hanya boleh berisi huruf dan angka.',
|
||||
'alamat.regex' => 'Alamat hanya boleh berisi huruf, angka, spasi, titik, koma, tanda hubung, dan tanda petik dua.',
|
||||
|
|
|
|||
Loading…
Reference in New Issue