Skip to content

Commit 08e68e4

Browse files
authored
(Laravel) - force updating to a new number (#9915)
* Update Controller.php * ensure random int is valid
1 parent 735cd65 commit 08e68e4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

frameworks/PHP/laravel/app/Http/Controllers/Controller.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public function updates($queries = 1)
5252

5353
while ($queries--) {
5454
$row = World::query()->find(self::randomInt());
55-
$row->randomNumber = self::randomInt();
55+
while (($randomInt = self::randomInt()) === $row->randomNumber) {}
56+
$row->randomNumber = $randomInt;
5657
$row->save();
5758

5859
$rows[] = $row;

0 commit comments

Comments
 (0)