Laravel Workflow

Submitted by rmcdaniel - 2 years ago

Workflows are more powerful than Laravel's job chaining or batching because they provide a way to implement complex, multi-step processes that can be resumed from a previous state if they fail or crash. https://github.com/laravel-workflow/laravel-workflow

use Workflow\ActivityStub;
use Workflow\Workflow;

class MyWorkflow extends Workflow
{
    public function execute()
    {
        return [
            yield ActivityStub::make(TestActivity::class),
            yield ActivityStub::make(TestOtherActivity::class),
            yield ActivityStub::all([
                ActivityStub::make(TestParallelActivity::class),
                ActivityStub::make(TestParallelOtherActivity::class),
            ]),
        ];
    }
}