I would like to set a timestamp value indicating when a particular operation was undertaken. That will involve me setting a time value before creating a record, something similar to this.
->on( 'preCreate', function ( $editor, $values ) {
$editor
->field( 'datetime_created' )->setValue( '2014-03-19 11:44:40' );
} )
I use php code to set the datetime variable. I would like to use the database function NOW() instead.
I presume it would be something almost similar to this:
->on( 'preCreate', function ( $editor, $values ) {
$editor
->field( 'datetime_created' )->setValue( 'NOW()' );
} )
But off course its now working.
What options does the datatable editor give me to effectively use database functions?