2017 © Pedro Peláez
 

library workflow

this is a workflow package for laravel5

image

davin-bao/workflow

this is a workflow package for laravel5

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 1 Open issues
  • 2 Versions
  • 2 % Grown

The README.md

Workflow (Laravel5 Package)

thanks tao2581, If you need use to laravel 4, please add

"davin-bao/workflow": "v1.0"

Workflow package provides a simple way to add audit flow to Laravel5., (*1)

Quick start

Required setup

In the require key of composer.json file add the following, (*2)

"davin-bao/workflow": "dev-master"

Run the Composer update comand, (*3)

$ composer update

In your config/app.php add 'DavinBao\Workflow\WorkflowServiceProvider' to the end of the $providers array, (*4)

'providers' => array(

    'Illuminate\Foundation\Providers\ArtisanServiceProvider',
    'Illuminate\Auth\AuthServiceProvider',
    ...
    'DavinBao\Workflow\WorkflowServiceProvider',

),

At the end of config/app.php add 'Workflow' => 'DavinBao\Workflow\WorkflowFacade' to the $aliases array, (*5)

'aliases' => array(

    'App'        => 'Illuminate\Support\Facades\App',
    'Artisan'    => 'Illuminate\Support\Facades\Artisan',
    ...
    'Workflow'       => 'DavinBao\Workflow\WorkflowFacade',

),

Configuration

Create Table

Now generate the Workflow migration, (*6)

$ php artisan workflow:migration

It will generate the <timestamp>_workflow_setup_tables.php migration. You may now run it with the artisan migrate command: Open: <timestamp>_workflow_setup_tables.php change " {{ '<?php' }} " to " <?php " $ php artisan migrate, (*7)

After the migration, workflow tables will be present., (*8)

Create Controllers

$ php artisan workflow:controllers

Create Routes

$ php artisan workflow:routes
    class Entry extends Eloquent {
      use \DavinBao\Workflow\HasFlowForResource;
    }

Add two function for audit log,Audit Flow will record this resource's title and content

        public function getLogTitle()
        {
            return $this->entry_title;
        }

        public function getLogContent()
        {
            return $this->entry_content;
        }
        class AdminEntryController extends AdminController {
                use \DavinBao\Workflow\HasFlowForResourceController;
        }

Add roles for this controller

        Route::get('entrys/{entry}/binding', 'AdminEntrysController@getBindingFlow');
        Route::post('entrys/{entry}/binding', 'AdminEntrysController@postBindingFlow');
        Route::get('entrys/{entry}/audit', 'AdminEntrysController@getAudit');
        Route::post('entrys/{entry}/audit', 'AdminEntrysController@postAudit');

Modify config

Set the propertly values to the config/auth.php and davin-bao/workflow/src/config/config.php ., (*9)

Functions

Get is binding audit flow

    if(isset($entry->isBinding)) {///is binding, do something }

Get resource audit status

    $entry->status()

Show flow Graph, show this resource audit flow status

@if(isset($entry->isBinding))
{{ Workflow::makeFlowGraph($entry->flow(), $entry->orderID()) }}
@endif

Show audit flow all details

 @if(isset($entry->isBinding))
{{ Workflow::makeAuditDetail($entry) }}
@endif

Need I audit, show audit button

    if(isset($entry->isBinding) && $entry->isMeAudit()) { /// show audit button }

The Versions

19/08 2016

dev-master

9999999-dev https://github.com/davin-bao/workflow

this is a workflow package for laravel5

  Sources   Download

MIT

The Requires

 

laravel workflow

19/08 2016

v1.0.x-dev

1.0.9999999.9999999-dev https://github.com/davin-bao/workflow

this is a workflow package for laravel

  Sources   Download

MIT

The Requires

 

laravel workflow