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 CHH; | |
trait MetaObject | |
{ | |
protected static $__metaClass; | |
static function setMetaClass(MetaClass $metaClass) | |
{ |
class PostsController < ActionController::Base | |
def create | |
Post.create(post_params) | |
end | |
def update | |
Post.find(params[:id]).update_attributes!(post_params) | |
end | |
private |
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
Support for keeping an audit trail for any state machine, borrowed from the Ruby StateMachine audit trail gem. Having an audit trail gives you a complete history of the state changes in your model. This history allows you to investigate incidents or perform analytics, like: “How long does it take on average to go from state a to state b?”, or “What percentage of cases goes from state a to b via state c?”
<?php | |
// this is the base controller which parses output to HTML/CSV/JSON depending on the format in the URL | |
use Illuminate\Support\Collection; | |
class FormatController extends Controller { | |
protected $fileName = 'export'; | |
protected $view = 'reports.output'; |
Regex search and replace for form helpers as follows: | |
Search: | |
\{\{ (Form\:\:.+) \}\} | |
Replace: | |
{!! $1 !!} |
echo "$STRING" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z |
<?php | |
namespace Helper; | |
// Select2 helpers for the jQuery based replacement for select boxes. | |
// See: http://select2.github.io/select2 | |
// Author: Tortue Torche <tortuetorche@spam.me> | |
// License: MIT | |
// | |
// Installation: | |
// * Put this file in your 'tests/_support/Helper' directory |
<?php | |
namespace App\Redis; | |
use Redis; | |
use Illuminate\Redis\Database as RedisDatabase; | |
use Illuminate\Contracts\Redis\Database as DatabaseContract; | |
class Database extends RedisDatabase implements DatabaseContract | |
{ |