add new validation rule and validation message for buket crud
This commit is contained in:
parent
eda8efedac
commit
94cc8cd1ef
|
|
@ -18,12 +18,12 @@ public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
//tmbah requirement
|
//tmbah requirement
|
||||||
'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\.\:\(\)\"\-\,]+$/',
|
||||||
'ukuran' => 'required|in:S,M,L',
|
'ukuran' => 'required|in:S,M,L',
|
||||||
'kategori' => 'required|in:single,fresh,premium_fresh,artificial',
|
'kategori' => 'required|in:single,fresh,premium_fresh,artificial',
|
||||||
'harga' => 'required|numeric|min:0',
|
'harga' => 'required|numeric|min:0',
|
||||||
'request_khusus' => 'required|string|min:3|max:100|regex:/^[a-zA-Z0-9\s\.,:"-]+$/',
|
'request_khusus' => 'required|string|min:3|max:100|regex:/^[a-zA-Z0-9\s\.\:\(\)\"\-\,]+$/',
|
||||||
'deskripsi' => 'required|string|min:3|min:100|regex:/^[a-zA-Z0-9\s\.,:"-]+$/',
|
'deskripsi' => 'required|string|min:3|min:170|regex:/^[a-zA-Z0-9\s\.\:\(\)\"\-\,]+$/',
|
||||||
'foto' => $this->isMethod('post')
|
'foto' => $this->isMethod('post')
|
||||||
? 'required|image|mimes:jpeg,png,jpg|max:2048'
|
? 'required|image|mimes:jpeg,png,jpg|max:2048'
|
||||||
: 'nullable|image|mimes:jpeg,png,jpg|max:2048',
|
: 'nullable|image|mimes:jpeg,png,jpg|max:2048',
|
||||||
|
|
@ -33,12 +33,13 @@ public function rules(): array
|
||||||
public function messages(): array
|
public function messages(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'required' => 'Kolom :attribute tidak boleh kosong.',
|
'required' => ':attribute wajib diisi.',
|
||||||
'string' => 'Input :attribute harus berupa teks valid.',
|
|
||||||
'min' => ':attribute terlalu pendek, minimal harus :min karakter.',
|
|
||||||
'max' => ':attribute melebihi batas, maksimal :max karakter/KB.',
|
|
||||||
'in' => 'Pilihan :attribute tidak sesuai dengan data yang tersedia.',
|
|
||||||
'numeric' => ':attribute harus berupa angka.',
|
'numeric' => ':attribute harus berupa angka.',
|
||||||
|
'string' => ':attribute harus berupa teks valid.',
|
||||||
|
'min' => ':attribute terlalu pendek, minimal :min karakter.',
|
||||||
|
'max' => ':attribute terlalu panjang, maksimal :max karakter.',
|
||||||
|
'in' => 'Pilihan :attribute tidak sesuai dengan data yang tersedia.',
|
||||||
|
'regex' => ':attribute hanya boleh berisi huruf, angka, spasi, titik, koma, titik dua, tanda hubung, tanda kurung, garis miring, dan tanda petik dua.',
|
||||||
'image' => ':attribute harus berupa file gambar (foto).',
|
'image' => ':attribute harus berupa file gambar (foto).',
|
||||||
'mimes' => 'Format :attribute tidak didukung. Gunakan format: jpeg, png, atau jpg.',
|
'mimes' => 'Format :attribute tidak didukung. Gunakan format: jpeg, png, atau jpg.',
|
||||||
'foto.max' => 'Ukuran :attribute terlalu besar, maksimal adalah 2MB.',
|
'foto.max' => 'Ukuran :attribute terlalu besar, maksimal adalah 2MB.',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue