PHP code example of alfasix / alfakit-workflows

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

    

alfasix / alfakit-workflows example snippets


use AlfaSix\AlfakitWorkflows\WorkflowsPlugin;

$panel->plugin(WorkflowsPlugin::make()->navigationGroup('Work'));

use AlfaSix\AlfakitWorkflows\ApprovalStep;
use AlfaSix\AlfakitWorkflows\Concerns\HasWorkflow;
use AlfaSix\AlfakitWorkflows\State;
use AlfaSix\AlfakitWorkflows\Transition;
use AlfaSix\AlfakitWorkflows\Workflow;

class Invoice extends Model
{
    use HasWorkflow;

    public static function workflow(): Workflow
    {
        return Workflow::make('invoice')
            ->states([
                State::make('draft')->color('gray'),
                State::make('submitted')->color('warning'),
                State::make('approved')->color('success'),
                State::make('rejected')->color('danger'),
                State::make('paid')->color('primary')->final(),
            ])
            ->transitions([
                Transition::make('submit')->from('draft')->to('approved')
                    ->

// Resource view page
protected function getHeaderActions(): array
{
    return [WorkflowActions::make()->dropdown(false)];
}

// Infolist
WorkflowStateEntry::make(),
WorkflowDiagram::make(),
WorkflowTimeline::make(),

// Table
WorkflowStateColumn::make(),
WorkflowStateFilter::make(),
->recordActions([WorkflowActions::make()])

Schedule::command('alfakit-workflows:process')->everyFifteenMinutes();
bash
composer vendor:publish --tag=alfakit-workflows-migrations
php artisan migrate