You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public function setHighestOrderNumber(): void
{
$orderColumnName = $this->determineOrderColumnName();
$this->$orderColumnName = $this->getHighestOrderNumber() + 1;
}
public function getHighestOrderNumber(): int
{
return (int) $this->buildSortQuery()->max($this->determineOrderColumnName());
}
...seems to generate the order number, using max then simply adds one to it.
But if one fired enough of these in succession, wouldn't it be possible to get the same max? And hence, on might get an order column with value 1,1,1,2,3,4,5?
This discussion was converted from issue #123 on February 27, 2022 08:10.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The following code (from
eloquent-sortable/src/SortableTrait.php
Line 21 in 6f72236
...seems to generate the order number, using
max
then simply adds one to it.But if one fired enough of these in succession, wouldn't it be possible to get the same
max
? And hence, on might get an order column with value1,1,1,2,3,4,5
?Beta Was this translation helpful? Give feedback.
All reactions