修改curd创建model文件时排序增加失效

pull/436/head
郭宇鹏 2023-03-17 17:00:20 +08:00
parent 0433dc4b30
commit d1812cf38f
1 changed files with 4 additions and 2 deletions

View File

@ -2,7 +2,9 @@
protected static function init()
{
self::afterInsert(function ($row) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['{%order%}' => $row[$pk]]);
if (!isset($row['{%order%}'])){
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['{%order%}' => $row[$pk]]);
}
});
}