Skip to content

Commit aa4b908

Browse files
committed
Updated key.php example to use config_item('rest_keys_table') instead of hardcoded 'keys' table name. Also removed the vardump (leftover from debugging?)
1 parent 8b8c0ba commit aa4b908

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

application/controllers/api/key.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,39 +214,38 @@ private function _generate_key()
214214

215215
private function _get_key($key)
216216
{
217-
return $this->rest->db->where('key', $key)->get('keys')->row();
217+
return $this->rest->db->where('key', $key)->get(config_item('rest_keys_table'))->row();
218218
}
219219

220220
// --------------------------------------------------------------------
221221

222222
private function _key_exists($key)
223223
{
224-
return $this->rest->db->where('key', $key)->count_all_results('keys') > 0;
224+
return $this->rest->db->where('key', $key)->count_all_results(config_item('rest_keys_table')) > 0;
225225
}
226226

227227
// --------------------------------------------------------------------
228228

229229
private function _insert_key($key, $data)
230230
{
231-
var_dump($data);
232231

233232
$data['key'] = $key;
234233
$data['date_created'] = function_exists('now') ? now() : time();
235234

236-
return $this->rest->db->set($data)->insert('keys');
235+
return $this->rest->db->set($data)->insert(config_item('rest_keys_table'));
237236
}
238237

239238
// --------------------------------------------------------------------
240239

241240
private function _update_key($key, $data)
242241
{
243-
return $this->rest->db->where('key', $key)->update('keys', $data);
242+
return $this->rest->db->where('key', $key)->update(config_item('rest_keys_table'), $data);
244243
}
245244

246245
// --------------------------------------------------------------------
247246

248247
private function _delete_key($key)
249248
{
250-
return $this->rest->db->where('key', $key)->delete('keys');
249+
return $this->rest->db->where('key', $key)->delete(config_item('rest_keys_table'));
251250
}
252-
}
251+
}

0 commit comments

Comments
 (0)