@@ -529,9 +529,10 @@ public function prepare_wheres_not_statement($wheres)
529529 * @param $table
530530 *
531531 * @return bool|\CI_DB_query_builder|object
532+ * @throws \HungNG_CI_Exception
532533 * @author : 713uk13m <dev@nguyenanhung.com>
533534 * @copyright: 713uk13m <dev@nguyenanhung.com>
534- * @time : 08/02 /2023 42:52
535+ * @time : 27/03 /2023 15:20
535536 */
536537 public function only_status_is_active ($ act = true , $ field = 'status ' , $ table = '' )
537538 {
@@ -540,11 +541,11 @@ public function only_status_is_active($act = true, $field = 'status', $table = '
540541 $ useField = !empty ($ field ) ? trim ($ field ) : 'status ' ;
541542 $ tableExists = $ this ->db ->table_exists ($ tableName );
542543 if ($ tableExists === false ) {
543- return $ this -> db ;
544+ throw new HungNG_CI_Exception ( ' Table ' . $ tableName . ' không tồn tại ' , 404 ) ;
544545 }
545546 $ fieldExists = $ this ->db ->field_exists ($ useField , $ tableName );
546547 if ($ fieldExists === false ) {
547- return $ this -> db ;
548+ throw new HungNG_CI_Exception ( ' Field ' . $ useField . ' không tìm thấy trong bảng ' . $ tableName , 404 ) ;
548549 }
549550
550551 return $ this ->db ->where ($ tableName . '. ' . $ useField , self ::DEFAULT_STATUS_IS_ACTIVE );
@@ -561,9 +562,10 @@ public function only_status_is_active($act = true, $field = 'status', $table = '
561562 * @param $table
562563 *
563564 * @return bool|\CI_DB_query_builder|object
565+ * @throws \HungNG_CI_Exception
564566 * @author : 713uk13m <dev@nguyenanhung.com>
565567 * @copyright: 713uk13m <dev@nguyenanhung.com>
566- * @time : 08/02 /2023 42 :52
568+ * @time : 27/03 /2023 17 :52
567569 */
568570 public function only_status_is_de_active ($ act = true , $ field = 'status ' , $ table = '' )
569571 {
@@ -572,11 +574,11 @@ public function only_status_is_de_active($act = true, $field = 'status', $table
572574 $ useField = !empty ($ field ) ? trim ($ field ) : 'status ' ;
573575 $ tableExists = $ this ->db ->table_exists ($ tableName );
574576 if ($ tableExists === false ) {
575- return $ this -> db ;
577+ throw new HungNG_CI_Exception ( ' Table ' . $ tableName . ' không tồn tại ' , 404 ) ;
576578 }
577579 $ fieldExists = $ this ->db ->field_exists ($ useField , $ tableName );
578580 if ($ fieldExists === false ) {
579- return $ this -> db ;
581+ throw new HungNG_CI_Exception ( ' Field ' . $ useField . ' không tìm thấy trong bảng ' . $ tableName , 404 ) ;
580582 }
581583
582584 return $ this ->db ->where ($ tableName . '. ' . $ useField , self ::DEFAULT_STATUS_IS_DE_ACTIVE );
0 commit comments