1. Go to this page and download the library: Download teamzac/laravel-workflows library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
teamzac / laravel-workflows example snippets
namespace App\Workflows;
use TeamZac\Workflows\AbstractWorkflow;
class TestWorkflow extends AbstractWorkflow
{
protected $steps = [
'App\Workflows\StepOne',
'App\Workflows\StepTwo',
'App\Workflows\StepThree',
];
}
namespace App\Providers;
use TeamZac\Workflow\Facades\Workflow;
class AppServiceProvider
{
public function boot()
{
Workflow::extend('test-workflow', function() {
return new \App\Workflows\TestWorkflow;
});
}
}
// by calling run() directly on the instance
$instance->run();
// by passing it through the Workflow facade
Workflow::run($instance);
// by manually creating an instance of the Workflow driver, setting the instance, and calling run
Workflow::driver('test-workflow')->setInstance($instance)->run();