bantenprov/workflow

The Workflow package for manage state and transition

1.0.1 2017-12-16 07:48 UTC

This package is not auto-updated.

Last update: 2024-05-16 03:30:53 UTC


README

Join the chat at https://gitter.im/bantenprov-workflow/Lobby Scrutinizer Code Quality Build Status

Workflow Management

Workflow management for easily manage states and transitions in a complex business prosess.

The final of this package will be contained some awesome feature:

  • Workflow
  • Workflow State
  • Workflow Transition
  • Workflow Notification
  • Workflow Guard
  • Transition Attachment
  • Attachment
  • Notification To
  • Notification cc
  • History

Workflow Management

Join the chat at https://gitter.im/bantenprov-workflow/Lobby Workflow management for easily manage states and transitions in a complex business prosess.

Scrutinizer Code Quality Build Status

The final of this package will be contained some awesome feature:

Worklow

  • Define a name and descriotion of the workflow, each conte type could containt more then one workflow to manage their business process

State

  • Define a collection of state name in worflow related, and describe the latest status the content in a business process

Transition

  • Define a transition of any state in content, this feature will be handle move transition

Guard

  • Guard give a permission to manage one or any authorization of the role management to the transition related

Notification

  • When a state of content was change, or a transition executed a notification will be sent by system to pic related. notification displayed in user desktop related and as mail notification.

TODO

See TODO before use this.

DEMO

Demo site for this packages is available here : Workflow.

Install Laravel :

$ composer create-project --prefer-dist laravel/laravel project-name "5.4.*"

Install package :

$ composer require bantenprov/workflow "1.0.0"

Edit config/config.php

Edit config/app.php

providers

'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

'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,

Artisan command :

$ 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

Contoh penggunaan :

Trait :

1. WorkflowStateTrait

use Bantenprov\Workflow\Traits\WorkflowStateTrait;

class WorkflowStateController extends Controller
{
    use WorkflowStateTrait;

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

2. WorkflowTransitionTrait

use Bantenprov\Workflow\Traits\WorkflowTransitionTrait;

class WorkflowTransitionController extends Controller
{
    use WorkflowTransitionTrait;

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

WorkflowStateTrait sample

#
Method NULL Default Ex Type
1 stateIndex($page = 10) Y 10 $page=10 Integer
2 stateCreate() Y - - -
3 stateStore($request,= array()) N - $request->all() Array
4 stateEdit($id) N -
$id = 1
Integer
5 stateUpdate($request= array(), $id) N -
$request->all()
$id = 1
Array
6 stateActive($id) N - $id = 1
Integer
7 stateDeActive($id) N - $id = 1
Integer

WorkflowTransitionTrait sample

#
Method NULL Default Ex Type
1 transitionIndex($page = 10) Y 10 $page=10 Integer
2 transitionCreate() Y - - -
3 transitionStore($request = array()) N - $request->all() Array
4 transitionEdit($id) N -
$id = 1
Integer
5 transitionUpdate($request = array(), $id) N -
$request->all()
$id = 1
Array
6 transitionActive($id) N - $id = 1
Integer
7 transitionDeActive($id) N - $id = 1
Integer

Contoh 2

pada aplikasi yang digunakan

//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);
}

CSS

folder style.css : public/css/style.css

<!-- layout.blade.php -->
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">        
        <title>Laravel</title>

        <!-- Fonts -->
  -->   <link href="{{ asset('css/workflow_style.css') }}" rel="stylesheet" type="text/css">

JS

folder custom.js : public/js/custom.js

<!-- layout.blade.php -->
          
            </div>
        </div>
  -->   <script src="{{ asset('js/workflow_javascript.js') }}"></script>
    </body>
</html>