Skip to content

Commit 7da99cd

Browse files
authored
Merge pull request #3 from petecoop/patch-1
Fix Randomness
2 parents ba1105d + 9036f50 commit 7da99cd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/RandomCommandServiceProvider.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ public function boot()
1616
}
1717

1818
$this->app->booted(function () {
19-
$hour = cache(['random.hour' => rand(0, 23);], now()->endofday();
20-
$minute = cache(['random.minute' => rand(0, 59);], now()->endofday();
21-
19+
$hour = cache('random.hour') ?? rand(0, 23);
20+
$minute = cache('random.minute') ?? rand(0, 59);
21+
22+
cache(['random.hour' => $hour], now()->endofday());
23+
cache(['random.minute' => $minute], now()->endofday());
24+
2225
$schedule = $this->app->make(Schedule::class);
2326
$schedule->command('random')->dailyAt("{$hour}:{$minute}");
2427
});

0 commit comments

Comments
 (0)