'required|string|not_regex:/^\d+$/|max:255' ]; if ($this->method() == 'PUT') { $rules['code'] = 'required|max:50|unique:ijin_usaha,code,' . $this->id; } else { $rules['code'] = 'required|max:50|unique:ijin_usaha,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 Ijin Usaha harus diisi!', 'code.max' => 'Kode Ijin Usaha maksimal 255 huruf!', 'code.unique' => 'Kode Ijin Usaha tidak boleh sama!', 'name.required' => 'Nama Ijin Usaha harus diisi!', 'name.not_regex' => 'Nama Ijin Usaha harus berupa huruf!', 'name.max' => 'Nama Ijin Usaha maksimal 255 huruf!' ]; } }