Skip to content

[5.8] Add schedule event helpers to deal with successful/failed commands#28167

Merged
taylorotwell merged 1 commit into
laravel:5.8from
kbond:schedule-exit-helpers
Apr 11, 2019
Merged

[5.8] Add schedule event helpers to deal with successful/failed commands#28167
taylorotwell merged 1 commit into
laravel:5.8from
kbond:schedule-exit-helpers

Conversation

@kbond

@kbond kbond commented Apr 10, 2019

Copy link
Copy Markdown
Contributor

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
@taylorotwell

Copy link
Copy Markdown
Member

Can you send a PR to the documentation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants