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

[10.x] Add Conditional Sleeps #47114

Merged
merged 5 commits into from
May 17, 2023
Merged

Conversation

bradietilley
Copy link
Contributor

This PR is spun off from #47100 and implements the interface that @nunomaduro suggested:

Sleep::for(1)->second()->unless($task->completed());
// or
Sleep::for(1)->second()->when($task->pending());

It also supports a Closure condition (bool return type)

Sleep::for(1)->second()->unless(fn () => $task->completed());
// or
Sleep::for(1)->second()->when(fn () => $task->pending());

If the Closure support is unwanted then I'll get rid of it 🤷

@taylorotwell taylorotwell merged commit 1719c36 into laravel:10.x May 17, 2023
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