public function handle($eventName, $data = null)
    {
        $results = [];

        if ($actions = $this->getEventActions($eventName)) {

            $actions = is_array($actions) ? $actions : [$actions];
            $data = is_array($data) ? $data : [$data];

            foreach ($actions as $action) {
                if ($result = $this->call($eventName, $action, $data)) {
                    $results[$action] = $result;
                }
            }
        }

        return count($results) === 1 ? reset($results) : $results;
    }
public function handle($eventName, $data = null)
    {
        $results = [];

        if ($actions = $this->getEventActions($eventName)) {

            $actions = is_array($actions) ? $actions : [$actions];
            $data = is_array($data) ? $data : [$data];

            foreach ($actions as $action) {
                if ($result = $this->call($eventName, $action, $data)) {
                    $results[$action] = $result;
                }
            }
        }

        return count($results) === 1 ? reset($results) : $results;
    }
public function handle ( $ eventName , $ data = null ) { $ results = [ ] ; if ( $ actions = $ this -> getEventActions ( $ eventName ) ) { $ actions = is_array ( $ actions ) ? $ actions : [ $ actions ] ; $ data = is_array ( $ data ) ? $ data : [ $ data ] ; foreach ( $ actions as $ action ) { if ( $ result = $ this -> call ( $ eventName , $ action , $ data ) ) { $ results [ $ action ] = $ result ; } } } return count ( $ results ) === 1 ? reset ( $ results ) : $ results ; }
Handles the event

@param      $eventName
@param null $data

@return array|mixed
Handles the event