ID(AI,PK) | Username | Password |CreatedAt|UpdatedAt|CreatedBy|UpdatedBy|
Above is the table structure where i am just entering the username and password, and CreatedAt|UpdatedAt|CreatedBy|UpdatedBy| will be added autometically.
here is my code to add the username and password
public function crudUsers()
{
$crud = new grocery_CRUD();
$crud->set_table("users");
$crud->set_subject("Website Users");
// Show in
$crud->add_fields(["username", "password"]);
$crud->edit_fields(["username", "password"]);
$crud->columns(["username", "password","CreatedAt","UpdatedAt","CreatedBy","UpdatedBy"]);
$data = (array) $crud->render();
$this->layout->set_wrapper( 'grocery', $data,'page', false);
$template_data['grocery_css'] = $data['css_files'];
$template_data['grocery_js'] = $data['js_files'];
$template_data["title"] = "Website Pages";
$template_data["crumb"] = ["table" => ""];
$this->layout->auth();
$this->layout->render('admin', $template_data);
}
I have tried using https://www.grocerycrud.com/documentation/options_functions/callback_after_update this works but i don't find it is good approach to insert and update values again using query. Also the callbacks needs to be created for each and every functions i will use in future.
I like this and tried the code https://www.amitsgarage.com/knowledge-base/grocerycrud/default-values-for-add-form
This code gives the error at "$data->field_values = $this->get_add_values(null); " because this function is not there which is obvious.
I have tried other multiple options but can not able to find any good universal function which help me.
Any suggestions please?
