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