Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.3] Add HourlyAt() option for scheduled events #17168

Merged
merged 6 commits into from
Jan 6, 2017
Merged
Show file tree
Hide file tree
Changes from 5 commits
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
11 changes: 11 additions & 0 deletions src/Illuminate/Console/Scheduling/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 string $offset
Copy link
Member

Choose a reason for hiding this comment

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

string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah - good pickup. Fixed now

* @return $this
*/
public function hourlyAt($offset)
{
return $this->spliceIntoPosition(1, $offset);
}

/**
* Schedule the event to run daily.
*
Expand Down
3 changes: 3 additions & 0 deletions tests/Console/ConsoleScheduledEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down