Compare commits

..

No commits in common. "1a8f81cc354f61216b4ce12f49f75baf0e4763ed" and "de5c92e78a157760b0d5d29f6ce37636851dbd11" have entirely different histories.

3 changed files with 5 additions and 11 deletions

View File

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

View File

@ -23,10 +23,8 @@ class UserRule extends Model
protected static function init() protected static function init()
{ {
self::afterInsert(function ($row) { self::afterInsert(function ($row) {
if (!$row['weigh']) { $pk = $row->getPk();
$pk = $row->getPk(); $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
}
}); });
} }

View File

@ -24,9 +24,7 @@ class Category extends Model
protected static function init() protected static function init()
{ {
self::afterInsert(function ($row) { self::afterInsert(function ($row) {
if (!$row['weigh']) { $row->save(['weigh' => $row['id']]);
$row->save(['weigh' => $row['id']]);
}
}); });
} }