We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8ab68c4 commit 2e9447eCopy full SHA for 2e9447e
database/factories/BookFactory.php
@@ -6,8 +6,6 @@
6
7
class BookFactory extends Factory
8
{
9
- private static int $VISUAL_INDEX = 0;
10
-
11
private static array $VISUALS = [
12
'229/9782070585229',
13
'904/9782070624904',
@@ -115,16 +113,10 @@ public function definition()
115
113
116
114
private function getVisual(string $size = 'L'): string
117
118
- $visual = sprintf(
+ return sprintf(
119
'https://images.epagine.fr/%s_1_%s.jpg',
120
- self::$VISUALS[self::$VISUAL_INDEX],
+ self::$VISUALS[array_rand(self::$VISUALS)],
121
['S' => 'v', 'M' => 'm', 'L' => '75'][$size] ?? '75'
122
);
123
124
- if (++self::$VISUAL_INDEX >= count(self::$VISUALS)) {
125
- self::$VISUAL_INDEX = 0;
126
- }
127
128
- return $visual;
129
}
130
0 commit comments