is actually very simple. If anyone who has used tp3.2 and knows this requirement has the hook function before 3.2, I used to use it very comfortably, so I turned to 5.0, and I was also looking for ways to use it. I know that there is no hook. Now it is an event, and there is documentation, so I will write it as follows
protected static function init ()
{
Ad::event("before_insert", function ($user) {
$user->addtime=time();
});
Ad::event("before_update", function ($data) {
$data->uptime=time();
});
}
beforecurdbeforeafter
protected static function init()
{
Ad::event("after_insert", function ($user) {
$user->addtime=time();
});
Ad::event("after_update", function ($data) {
$data->uptime=time();
});
}
3.2after insert$dataidid5.0
< hr >
**before**