for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace Anomaly\Streams\Platform\Traits;
use Illuminate\Contracts\Bus\SelfHandling;
/**
* Class Hookable
*
* @link http://anomaly.is/streams-platform
* @author AnomalyLabs, Inc. <[email protected]>
* @author Ryan Thompson <[email protected]>
* @package Anomaly\Streams\Platform\Traits
*/
trait Hookable
{
* The registered hooks.
* @var array
protected static $hooks = [];
* Register a new hook.
* @param $hook
* @param $callback
* @return $this
public function hook($hook, $callback)
self::$hooks[$hook] = $callback;
return $this;
}
* Fire a set of closures by trigger.
* @param array $parameters
* @return mixed
public function call($hook, array $parameters = [])
return app()->call(self::$hooks[$hook], $parameters);
* Return if the hook exists.
* @return bool
public function hasHook($hook)
return isset(self::$hooks[$hook]);