PHP code example of bantenprov / workflow

1. Go to this page and download the library: Download bantenprov/workflow 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/ */

    

bantenprov / workflow example snippets


'providers' => [
    ...
    App\Providers\AppServiceProvider::class,
    App\Providers\AuthServiceProvider::class,
    App\Providers\EventServiceProvider::class,
    App\Providers\RouteServiceProvider::class,
    ...
    Collective\Html\HtmlServiceProvider::class,
    'That0n3guy\Transliteration\TransliterationServiceProvider',
    Bantenprov\Workflow\WorkflowServiceProvider::class,

'aliases' => [
    ...
    'Storage' => Illuminate\Support\Facades\Storage::class,
    'URL' => Illuminate\Support\Facades\URL::class,
    'Validator' => Illuminate\Support\Facades\Validator::class,
    'View' => Illuminate\Support\Facades\View::class,
    ...
    'Form' => Collective\Html\FormFacade::class,
    'Html' => Collective\Html\HtmlFacade::class,
    'Workflow' => Bantenprov\Workflow\Facades\Workflow::class,

use Bantenprov\Workflow\Traits\WorkflowStateTrait;

class WorkflowStateController extends Controller
{
    use WorkflowStateTrait;

    public function index()
    {
        return WorkflowStateTrait::stateIndex();
    }
}

use Bantenprov\Workflow\Traits\WorkflowTransitionTrait;

class WorkflowTransitionController extends Controller
{
    use WorkflowTransitionTrait;

    public function index()
    {
        return WorkflowStateTrait::transitionIndex();
    }
}

//Controller
use Bantenprov\Workflow\Workflow
...
public function SOMETHING()
{
    $id = 1;
    return \Workflow::getStateName($id);
}


//Controller
use Bantenprov\Workflow\Workflow
...
public function SOMETHING()
{
    $id = 1;
    return \Workflow::getTransitionName($id);
}

bash
$ php artisan vendor:publish --tag=workflow_migrations
$ php artisan vendor:publish --tag=workflow_views
$ php artisan vendor:publish --tag=workflow_css
$ php artisan vendor:publish --tag=workflow_js
$ php artisan migrate