Page model example:
<?php
class NotePage extends Page
{
public static function create(array $props): Page
{
$props['content']['createdon'] = date('Y-m-d h:i');
return parent::create($props);
}
}
NotePage
is the model for a page with the note
blueprint, so you would have to change this.
Using a model is useful if you only have one page type that needs this method. If you want to apply this to multiple page types, you either need as many models (or a based model that you extend) or a hook is the better option.