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
| if(file_exists('protected/components/' . $this->reportName . '.php')){ | |
| $reportModel = new $this->reportName; | |
| $this->reportTitle = $reportModel->reportTitle; | |
| $this->_report = $reportModel->getReport(); | |
| $this->reportContent = $this->_report->report; | |
| $this->downloadableReport = $this->_report->reportGrid; | |
| } else { | |
| $this->reportContent = 'No report of named type ' . $this->reportName ; | |
| } |
| <?php | |
| trait PhpUnitAssertionsTrait | |
| { | |
| /** | |
| * Asserts that an array has a specified key. | |
| * | |
| * @param mixed $key | |
| * @param array|ArrayAccess $array |
| <?php | |
| use Illuminate\Foundation\Testing\ApplicationTrait; | |
| use Illuminate\Foundation\Testing\AssertionsTrait; | |
| use Illuminate\Foundation\Testing\CrawlerTrait; | |
| use Illuminate\Support\Facades\Artisan; | |
| trait LaravelTrait | |
| { |
| <?php | |
| use Illuminate\Foundation\Testing\ApplicationTrait; | |
| use Illuminate\Foundation\Testing\AssertionsTrait; | |
| use Illuminate\Support\Facades\Artisan; | |
| trait LaravelTrait | |
| { | |
| /** |
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
| <?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;". |
Requires https://github.com/yohang/Finite
<?php
class StatefulModel extends Model
{
| 'mysql-local' => [ | |
| 'driver' => 'mysql', | |
| 'host' => env('DB_HOST', 'localhost') . ('homestead' == gethostname() ? null : ':33060'), | |
| 'port' => env('DB_PORT', '3306'), | |
| 'database' => env('DB_DATABASE', 'forge'), | |
| 'username' => env('DB_USERNAME', 'forge'), | |
| 'password' => env('DB_PASSWORD', ''), | |
| 'charset' => 'utf8', | |
| 'collation' => 'utf8_unicode_ci', | |
| 'prefix' => '', |