add new validation rule and validation message for additional

This commit is contained in:
LailaWulandarii 2026-02-12 13:49:34 +07:00
parent 49afee603a
commit 7931e28fcb
1 changed files with 6 additions and 6 deletions

View File

@ -16,7 +16,7 @@ public function authorize(): bool
public function rules(): array
{
return [
'nama' => 'required|string|min:3|max:100||regex:/^[a-zA-Z0-9\s\.,:"-]+$/',
'nama' => 'required|string|min:3|max:100|regex:/^[a-zA-Z0-9\s\.\:\(\)\"\-\,]+$/',
'harga' => 'required|numeric|min:0',
];
}
@ -24,12 +24,12 @@ public function rules(): array
public function messages(): array
{
return [
'required' => 'Kolom :attribute wajib diisi.',
'required' => ':attribute wajib diisi.',
'numeric' => ':attribute harus berupa angka.',
'string' => 'Input :attribute harus berupa teks valid.',
'regex' => ':attribute hanya boleh berisi huruf, angka, spasi, titik, koma, tanda hubung dan tanda petik dua.',
'min' => ':attribute minimal harus :min karakter/nilai.',
'max' => ':attribute melebihi batas maksimal :max karakter.',
'string' => ':attribute harus berupa teks valid.',
'regex' => ':attribute hanya boleh berisi huruf, angka, spasi, titik, koma, titik dua, tanda kurung, tanda hubung, dan tanda petik dua.',
'min' => ':attribute terlalu pendek, minimal :min karakter.',
'max' => ':attribute terlalu panjang, maksimal :max karakter.',
];
}