File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -592,17 +592,23 @@ public function like($field, string $value = ''): QueryBuilder
592592 }
593593
594594 /**
595- * @param array|string $cond
595+ * @param array|string $field
596+ * @param string $value
596597 * @return $this
597598 */
598- public function notLike ($ cond = [] ): QueryBuilder
599+ public function notLike ($ field , string $ value = '' ): QueryBuilder
599600 {
600- if ($ cond ) {
601- if (is_string ($ cond )) {
602- $ this ->where ($ cond );
603- } else if (is_array ($ cond )) {
604- $ this ->where ([[$ cond [0 ], 'NOT LIKE ' , $ cond [1 ]]]);
605- }
601+ if (empty ($ field )) {
602+ $ this ->setError ('Empty $field in ' . __METHOD__ );
603+ return $ this ;
604+ }
605+
606+ if (is_string ($ field ) && !empty ($ field ) && is_string ($ value ) && !empty ($ value )) {
607+ $ this ->where ([[$ field , 'NOT LIKE ' , $ value ]]);
608+ } else if (is_string ($ field ) && empty ($ value )) {
609+ $ this ->where ($ field );
610+ } else if (is_array ($ field )) {
611+ $ this ->where ([[$ field [0 ], 'NOT LIKE ' , $ field [1 ]]]);
606612 }
607613
608614 return $ this ;
You can’t perform that action at this time.
0 commit comments