Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frameworks/PHP/laravel/app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function updates($queries = 1)

while ($queries--) {
$row = World::query()->find(self::randomInt());
$row->randomNumber = self::randomInt();
$row->randomNumber = ($randomInt = self::randomInt()) !== $row->randomNumber ? $randomInt : $randomInt + 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If $randomInt is 10000 this would fail, as 10001 is invalid.
Other frameworks generate a new random number instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! was not aware of that requirement. I've updated the method accordingly.

$row->save();

$rows[] = $row;
Expand Down