example call function after insert grocery crud codeigniter

Solutions on MaxInterview for example call function after insert grocery crud codeigniter by the best coders in the world

showing results for - "example call function after insert grocery crud codeigniter"
Jan
10 Jan 2021
1 
2public function users() {
3    $crud = new grocery_CRUD();
4 
5    $crud->set_table('users');
6    $crud->set_subject('User');
7    $crud->required_fields('username');
8 
9    $crud->columns('username', 'email', 'real_name', 'active');
10    $crud->fields('username', 'email', 'password', 'real_name', 'active');
11 
12    $crud->callback_after_insert(array($this, 'log_user_after_insert'));
13    $crud->callback_after_update(array($this, 'log_user_after_update'));
14 
15    $output = $crud->render();
16 
17    $this->_example_output($output);
18}
19 
20function log_user_after_insert($post_array,$primary_key)
21{
22    $user_logs_insert = array(
23        "user_id" => $primary_key,
24        "created" => date('Y-m-d H:i:s'),
25        "last_update" => date('Y-m-d H:i:s')
26    );
27 
28    $this->db->insert('user_logs',$user_logs_insert);
29 
30    return true;
31}
32 
Dylan
04 Apr 2018
1void callback_after_insert(mixed $callback )