仓库初始化
This commit is contained in:
10
application/admin/command/Crud/stubs/mixins/modelinit.stub
Normal file
10
application/admin/command/Crud/stubs/mixins/modelinit.stub
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
self::afterInsert(function ($row) {
|
||||
if (!$row['{%order%}']) {
|
||||
$pk = $row->getPk();
|
||||
$row->getQuery()->where($pk, $row[$pk])->update(['{%order%}' => $row[$pk]]);
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user