public function delete($id) { $this->db->start_transaction(); # delete city related by state $city = new CityModel(); $city->delete_by_state($id); # remove the state itself $condition = array(StateModel::$primary_key => $id); $this->db->delete(StateModel::$table_name, $condition); $this->db->complete_transaction(); return $this->db->transaction_status(); }