'required|string|not_regex:/^\d+$/|max:255', 'jenis_kantor' => 'required' ]; if ($this->method() == 'PUT') { $rules['code'] = 'required|max:50|unique:kjpp,code,' . $this->id; } else { $rules['code'] = 'required|max:50|unique:kjpp,code'; } return $rules; } /** * Determine if the user is authorized to make this request. */ public function authorize(): bool { return true; } public function messages(): array { return [ 'code.required' => 'Kode KJPP harus diisi!', 'code.max' => 'Kode KJPP maksimal 255 huruf!', 'code.unique' => 'Kode KJPP tidak boleh sama!', 'name.required' => 'Nama KJPP harus diisi!', 'name.not_regex' => 'Nama KJPP harus berupa huruf!', 'name.max' => 'Nama KJPP maksimal 255 huruf!', 'jenis_kantor.required' => 'Jenis Kantor harus diisi!' ]; } }