Add a DSL to the PHP Finite package, borrowed from the Ruby StateMachine gem.
In your Stateful Class, add the stateMachineConfig() method and call initStateMachine() method at initialization (__contruct() method).
Example
| #!/bin/bash | |
| laravel new $1 | |
| # Change Dir | |
| cd $1 | |
| # Update .env | |
| sed -i "s/APP_NAME=Laravel/APP_NAME=$1/g" .env | |
| sed -i "s/DB_DATABASE=laravel/DB_DATABASE=$1/g" .env |
| #!/bin/bash | |
| # Post install script for Ubuntu 16.04LTS and Mint 18LTS | |
| # add the PHP PPA https://deb.sury.org/ | |
| sudo add-apt-repository -y ppa:ondrej/php | |
| # I believe even releases are LTS, so when 8 comes out should update | |
| curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - | |
| # add Sublime Text 3 stable to your sources |
| <?php namespace App\Finite; | |
| /** | |
| * The FiniteAuditTrail Trait. | |
| * This plugin, for the Finite package (see https://github.com/yohang/Finite), adds support for keeping an audit trail for any state machine. | |
| * Having an audit trail gives you a complete history of the state changes in your stateful model. | |
| * Prerequisites: | |
| * 1. Install Finite package (https://github.com/yohang/Finite#readme) | |
| * 2. Use FiniteStateMachine in your model (https://gist.github.com/tortuetorche/6365575) | |
| * Usage: in your Stateful Class use this trait after FiniteStateMachine trait, like this "use FiniteAuditTrailTrait;". |
Add a DSL to the PHP Finite package, borrowed from the Ruby StateMachine gem.
In your Stateful Class, add the stateMachineConfig() method and call initStateMachine() method at initialization (__contruct() method).
Example