Skip to content

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