@@ -25,9 +25,6 @@ class HungNG_Custom_Based_model extends CI_Model
2525 /** @var string $tableName */
2626 protected $ tableName ;
2727
28- /** @var string $primary_key */
29- protected $ primary_key ;
30-
3128 /** @var string $is_not $is_not */
3229 protected $ is_not ;
3330
@@ -52,6 +49,18 @@ class HungNG_Custom_Based_model extends CI_Model
5249 /** @var array $field */
5350 protected $ field = array ();
5451
52+ /** @var string $primary_key */
53+ protected $ primary_key ;
54+
55+ /** @var string $created_at */
56+ protected $ created_at ;
57+
58+ /** @var string $updated_at */
59+ protected $ updated_at ;
60+
61+ /** @var string $deleted_at */
62+ protected $ deleted_at ;
63+
5564 /**
5665 * HungNG_Custom_Based_model constructor.
5766 *
@@ -64,6 +73,9 @@ public function __construct()
6473 $ this ->db = $ this ->load ->database ('default ' , true , true );
6574 $ this ->tableName = '' ;
6675 $ this ->primary_key = 'id ' ;
76+ $ this ->created_at = 'created_at ' ;
77+ $ this ->updated_at = 'updated_at ' ;
78+ $ this ->deleted_at = 'deleted_at ' ;
6779 $ this ->is_not = ' != ' ;
6880 $ this ->or_higher = ' >= ' ;
6981 $ this ->is_higher = ' > ' ;
@@ -468,15 +480,15 @@ public function update($id = '', $data = array())
468480 *
469481 * @param string $id
470482 *
471- * @return false| int
483+ * @return int
472484 * @author : 713uk13m <dev@nguyenanhung.com>
473485 * @copyright: 713uk13m <dev@nguyenanhung.com>
474- * @time : 08/16 /2021 29:40
486+ * @time : 09/20 /2021 38:36
475487 */
476488 public function delete ($ id = '' )
477489 {
478490 if (empty ($ id )) {
479- return false ;
491+ return 0 ;
480492 }
481493 $ this ->db ->where ($ this ->primary_key , $ id );
482494 $ this ->db ->delete ($ this ->tableName );
@@ -520,7 +532,7 @@ public function request_builder($search)
520532 */
521533 public function __destruct ()
522534 {
523- if ($ this ->db ) {
535+ if (is_object ( $ this ->db ) ) {
524536 $ this ->close ();
525537 }
526538 }
0 commit comments