callback_after_insert
void callback_after_insert(mixed $callback )
Quick Description: This is a callback after the auto insert of the CRUD.
This is a callback after the auto insert of the CRUD. The function of the callback takes two parameters , 1 - the post data and 2 - the insert key value . Return value for this callback is not required.
Example:
public function users() { $crud = new grocery_CRUD(); $crud->set_table('users'); $crud->set_subject('User'); $crud->required_fields('username'); $crud->columns('username', 'email', 'real_name', 'active'); $crud->fields('username', 'email', 'password', 'real_name', 'active'); $crud->callback_after_insert(array($this, 'log_user_after_insert')); $crud->callback_after_update(array($this, 'log_user_after_update')); $output = $crud->render(); $this->_example_output($output); } function log_user_after_insert($post_array,$primary_key) { $user_logs_insert = array( "user_id" => $primary_key, "created" => date('Y-m-d H:i:s'), "last_update" => date('Y-m-d H:i:s') ); $this->db->insert('user_logs',$user_logs_insert); return true; }