diff --git a/src/Illuminate/Console/Scheduling/Event.php b/src/Illuminate/Console/Scheduling/Event.php index 5268f4f62b98..47f7be90951a 100644 --- a/src/Illuminate/Console/Scheduling/Event.php +++ b/src/Illuminate/Console/Scheduling/Event.php @@ -344,6 +344,17 @@ public function hourly() return $this->spliceIntoPosition(1, 0); } + /** + * Schedule the event to run hourly at a given offset in the hour. + * + * @param int $offset + * @return $this + */ + public function hourlyAt($offset) + { + return $this->spliceIntoPosition(1, $offset); + } + /** * Schedule the event to run daily. * diff --git a/tests/Console/ConsoleScheduledEventTest.php b/tests/Console/ConsoleScheduledEventTest.php index 434d47a73b7b..86a0a298c7e7 100644 --- a/tests/Console/ConsoleScheduledEventTest.php +++ b/tests/Console/ConsoleScheduledEventTest.php @@ -67,6 +67,9 @@ public function testBasicCronCompilation() $event = new Event('php foo'); $this->assertEquals('0 * * * * *', $event->everyFiveMinutes()->hourly()->getExpression()); + $event = new Event('php foo'); + $this->assertEquals('37 * * * * *', $event->hourlyAt(37)->getExpression()); + $event = new Event('php foo'); $this->assertEquals('0 15 4 * * *', $event->monthlyOn(4, '15:00')->getExpression());