Hi
I was wondering, I am using Metabox Custom Table and tested out the new table 'model' system. All working fine by the way.
public function createHousekeepingModel() {
// Register a model
add_action( 'init', 'dc_register_housekeeping_model' );
function dc_register_housekeeping_model() {
mb_register_model( 'housekeeping', [
'table' => "housekeeping",
'labels' => [
'name' => 'Housekeeping',
'singular_name' => 'Housekeeping',
],
'menu_icon' => 'dashicons-money-alt',
'show_in_menu' => false, //show hide in admin menu
] );
}
}
The guide says that the model table is a CRUD system ("Complete CRUD for models so you can create/edit/delete them easily"). Do you have any metabox actions to insert, update and delete values into the database programmatically? without using the form fields? as for this one table I need to store system error logs. So no user interaction.
or do I have to do it like in the below example?
public function logEventAction($type, $date, $actiondate, $log) {
$this->wpdb->insert(
$this->table,
array(
'type' => $type,
'date' => $date,
'action_date' => $actiondate,
'log' => $log,
)
);
}