website/application/admin/command/Crud/stubs/mixins/modelinit.stub

11 lines
288 B
Plaintext
Raw Permalink Normal View History

2025-05-09 01:14:04 +08:00
protected static function init()
{
self::afterInsert(function ($row) {
if (!$row['{%order%}']) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['{%order%}' => $row[$pk]]);
}
});
}