Hello all,
I'm trying to create a field with a default value + Value of another field + Date of insert
Example of ID: IDPeter17112017
So, this is the code I have but it doesn't work, or maybe isn't the best way to do it.
$crud->add_fields('name','email','date');
$crud->callback_before_insert(function ($post_array) {
$name = $name['name'];
$date = $date['date'];
if (empty($post_array['id'])) {
$post_array['id'] = 'ID' . $name . $date;
}
return $post_array;
});
Any suggestions?
Thank you in advance!
