Trigger $event and run through all docks referenced, passing along $payload to all $callables.

@param null|string $event
@param null|mixed  $payload

@return $this|bool
513503
public function trigger($event = null, &$payload = null)
    {
        // Disallow calling a trigger on global docks
        if ($event === '*') {
            return $this;
        }

        // Get all global docks
        $globalDocks = [];
        if (isset($this->docks['*']) && count($this->docks['*']) > 0) {
            $globalDocks = $this->docks['*'];
        }

        // Check if the event exists and has callables to run
        if (!isset($this->docks[$event]) || count($this->docks[$event]) === 0) {
            // There are no specific docks, but maybe there's global docks?
            if (count($globalDocks) === 0) {
                // There is nothing to do here
                return $this;
            }
            $docks = $globalDocks;
        } else {
            $docks = $this->docks[$event];
            $docks = array_merge($docks, $globalDocks);
        }

        // All good, let's call those callables
        foreach ($docks as $dock) {
            $dock['callable']($event, $payload);

            // And include the template if we have one. Data should be passed to the template through
            // outside means like through the session or \Parable\GetSet or one of its sub-types.
            if ($dock['templatePath'] && file_exists($dock['templatePath'])) {
                ob_start();
                require $dock['templatePath'];
                $return = ob_get_clean();
                echo $return;
            }
        }
        return $this;
    }
181320
public function event($name, $payload = null) {
		$this->log->log("EVENT: $name",  Net_XMPP_XMPPHP_Log::LEVEL_DEBUG);
		foreach($this->eventhandlers as $handler) {
			if($name == $handler[0]) {
				if($handler[2] === null) {
					$handler[2] = $this;
				}
				$handler[2]->$handler[1]($payload);
			}
		}
		foreach($this->until as $key => $until) {
			if(is_array($until)) {
				if(in_array($name, $until)) {
					$this->until_payload[$key][] = array($name, $payload);
					if(!isset($this->until_count[$key])) {
						$this->until_count[$key] = 0;
					}
					$this->until_count[$key] += 1;
					#$this->until[$key] = false;
				}
			}
		}
	}
484846
protected function fireCacheEvent($event, $payload)
	{
		if (isset($this->events))
		{
			$this->events->fire('cache.'.$event, $payload);
		}
	}
478262
public function triggerEvent($event, Payload $payload): string
    {
        return $this->state($payload->state())->triggerEvent($event, $payload);
    }
1242949
public function onSaving($event, $payload)
    {
        list($model) = $payload;

        if (!$this->isEncodable($model)) {
            return;
        }

        foreach ($model->getDirtyEncodableAttributes() as $attribute) {

            // If the attribute has a value, encode the attribute
            if ($model->getAttribute($attribute)) {
                $model->encodeOnSave($attribute);
            }

            // Otherwise delete encoding references
            elseif ($encoding = $model->encoding($attribute)) {
                $encoding->delete();
            }
        }
    }
1059688
public function triggerEvent($event, Payload $payload)
    {
        if ($payload->state() === null) {
            $this->updatePayload($this->process->initialState(), $payload);
        }

        $state = $this->process->state($payload->state());

        $nextStateName = $state->triggerEvent($event, $payload);
        if ($nextStateName === null) {
            return;
        }

        $state = $this->process->state($nextStateName);

        $this->updatePayload($state, $payload);
        $this->handleOnStateWasSet($state, $payload);
    }
1074041
public function trigger(Payload $payload)
    {
        if (!$this->command) {
            return $this->targetState();
        }

        return call_user_func($this->command, $payload) ? $this->targetState() : $this->errorState();
    }
1263383
public function push($event, $payload = [])
    {
        $this->listen($event.'_pushed', function () use ($event, $payload) {
            $this->dispatch($event, $payload);
        });
    }
365067
public static function trigger($event, &$data)
    {
        if (!isset(self::$manager)) {
            self::init();
        }

        return self::$manager->triggerEvent($event, $data);
    }
202518
public function emit($event, Array $payload)
	{
		$m = $this->bareMessage(static::MESSAGE_TYPE_STANDARD);
		$m->Event = $event;
		$m->Payload = $payload;

		$this->send($m);
	}
439795
public function dispatch(Event $event) {
    
    foreach ($this->getSubscribers($event) as $subscriber) {
      $subscriber->trigger($event);
    }
    
    return $this;
  }
447803
protected function fire($event, $key, array $payload = [])
    {
        $payload[] = $this->context;

        if ($this->isEventsEnabled()) {
            $this->dispatcher->fire("settings.{$event}: {$key}", $payload);
        }
    }
775998
public static function trigger($event, $params = [])
	{
		if ( is_array(self::$listeners[$event]) ) {			
			foreach (self::$listeners[$event] as $callable) {
				$callable($event, $params);
			}			
		}
		if ( is_array(self::$listeners['*']) ) {			
			foreach (self::$listeners['*'] as $callable) {
				$callable($event, $params);
			}			
		}		
	}
188784
public function trigger($event,$params=[]){

        if (!isset($this->events[$event])){
            return $this;
        }

        if (!count($this->events[$event])){
            return $this;
        }

        $queue = new \SplPriorityQueue();

        foreach ($this->events[$event] as $index => $action){
            $queue->insert($index, $action['prio']);
        }

        $queue->top();

        while ($queue->valid()){
            $index = $queue->current();
            if (is_callable($this->events[$event][$index]['fn'])){
                if (call_user_func_array($this->events[$event][$index]['fn'], $params) === false) {
                    break; // stop Propagation
                }
            }
            $queue->next();
        }

        return $this;
    }
226672
protected function fireEvent($name, $payload = null)
    {
        if (! isset(static::$dispatcher)) {
            $this->initEventDispatcher();
        }

        static::$dispatcher->fire($name, $payload);
    }
1228687
public function handle($event, $payload)
    {
        list($model) = $payload;

        // Don't log changes to pivot models.  Even though a user may have initiated
        // this, it's kind of meaningless to them.  These events can happen when a
        // user messes with drag and drop positioning.
        if (is_a($model, \Illuminate\Database\Eloquent\Relations\Pivot::class)) {
            return;
        }

        // Get the action of the event
        preg_match('#eloquent\.(\w+)#', $event, $matches);
        $action = $matches[1];
        if (!in_array($action, $this->supported)) {
            return;
        }

        // Get the admin acting on the record
        $admin = app('decoy.user');

        // If `log_changes` was configed as a callable, see if this model event
        // should not be logged
        if ($check = config('decoy.site.log_changes')) {
            if (is_bool($check) && !$check) {
                return;
            }
            if (is_callable($check)) {
                \Log::error('Callable log_changes have been deprecated');
                if (!call_user_func($check, $model, $action, $admin)) {
                    return;
                }
            }
        } else {
            return;
        }

        // Check with the model itself to see if it should be logged
        if (method_exists($model, 'shouldLogChange')) {
            if (!$model->shouldLogChange($action)) {
                return;
            }

        // Default to not logging changes if there is no shouldLogChange()
        } else {
            return;
        }

        // Log the event
        Change::log($model, $action, $admin);
    }
841517
public function onSaving($event, $payload) {

        // Destructure params
        list($model) = $payload;

        // Check that the model supports uploads through Upchuck
        if (!$this->supportsUploads($model)
            || !($attributes = $model->getUploadAttributes())) return;

        // Loop through the all of the upload attributes ...
        event(new Events\HandlingSaving($model));
        foreach($attributes as $attribute) {

            // Check if there is an uploaded file in the upload attribute
            if (($file = $model->getAttribute($attribute))
                && is_a($file, UploadedFile::class)) {

                // Move the upload and get the new URL
                $url = $this->storage->moveUpload($file);
                $model->setUploadAttribute($attribute, $url);
            }

            // If the attribute field is dirty, delete the old file
            if ($model->isDirty($attribute)
                && !$this->keepsFilesOnDelete($model)
                && ($old = $model->getOriginal($attribute))) {
                $this->storage->delete($old);
            }
        }
        event(new Events\HandledSaving($model));
    }