'required|string|max:50', 'name' => 'required|string|max:255', 'biaya' => 'required|numeric', 'authorized_status' => 'nullable|boolean', ]; // Add unique validation for code field on create if ($this->isMethod('post')) { $rules['code'] .= '|unique:jenis_kartu,code'; } // Add unique validation for code field on update, excluding the current record if ($this->isMethod('put') || $this->isMethod('patch')) { $rules['code'] .= '|unique:jenis_kartu,code,' . $this->id; } return $rules; } }