db->table('sales_reward_points'); if (!$rewards_id || !$this->exists($rewards_id)) { // TODO: looks like we are missing the exists function in this class if ($builder->insert($rewards_data)) { $rewards_data['id'] = $this->db->insertID(); return true; } return false; } $builder->where('id', $rewards_id); return $builder->update($rewards_data); } }