Files
code-bang/backend/application/admin/command/Crud/stubs/mixins/modelinit.stub
T

11 lines
288 B
Plaintext
Raw Normal View History

2026-09-17 16:25:31 +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]]);
}
});
}