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.8] Add schedule event helpers to deal with successful/failed commands #28167

Merged
merged 1 commit into from Apr 11, 2019

Conversation

Projects
None yet
2 participants
@kbond
Copy link
Contributor

commented Apr 10, 2019

Now that the exit code is available for scheduled command events (#28140), it might be worth having the following helpers available.

protected function schedule(Schedule $schedule)
{
    $schedule->command('my:command')
        ->onSuccess(function () {
            // do something when scheduled command ran successfully
        })
        ->onFailure(function () {
            // do something when scheduled command failed
        })
        ->pingOnSuccess('https://example.com')
        ->pingOnFailure('https://example.com')
        ->emailOnFailure('johndoe@example.com')
    ;
}

@taylorotwell taylorotwell merged commit e81aa77 into laravel:5.8 Apr 11, 2019

2 checks passed

continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@taylorotwell

This comment has been minimized.

Copy link
Member

commented Apr 11, 2019

Can you send a PR to the documentation?

@kbond kbond deleted the kbond:schedule-exit-helpers branch Apr 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.