In case you've missed it, you are looking at an older version of the website. Checkout our latest version, we promise you will love it 😍

callback_after_delete

void callback_after_delete(mixed $callback )
Quick Description: The callback runs when the operation delete completed successfully

The callback runs when the operation delete completed successfully. The parameter that is insert is the primary key value. A return value is not required for this callback.

Example:

 
public function user(){
    $crud = new grocery_CRUD();
 
    $crud->set_table('cms_user');
    $crud->set_subject('User List');
    $crud->required_fields('username');
 
    $crud->columns('username','email','real_name','active');
    $crud->change_field_type('active', 'true_false');
 
    $crud->callback_after_delete(array($this,'user_after_delete'));
 
    $output = $crud->render();
 
    $this->_example_output($output);
}
 
public function user_after_delete($primary_key)
{
    return $this->db->insert('user_logs',array('user_id' => $primary_key,'action'=>'delete', 'updated' => date('Y-m-d H:i:s')));
}