/** * Log a query in the connection's query log. * * @param string $query * @param array $bindings * @return void */ public function logQuery($query, $bindings, $time = null) { if (isset($this->events)) { $this->events->fire('illuminate.query', array($query, $bindings, $time)); } $this->queryLog[] = compact('query', 'bindings', 'time'); }
/** * Log a query in the connection's query log. * * @param string $query * @param array $bindings * @return void */ public function logQuery($query, $bindings, $time = null) { if (isset($this->events)) { $parameters = compact('query', 'bindings', 'time'); $this->events->fire('illuminate.query', func_get_args()); } $this->queryLog[] = compact('query', 'bindings', 'time'); }
/** * Empty the cart * * @return boolean */ public function destroy() { // Fire the cart.destroy event $this->event->fire('cart.destroy'); $result = $this->updateCart(NULL); // Fire the cart.destroyed event $this->event->fire('cart.destroyed'); return $result; }
/** * Block Factory. * * @param string $type * @param string $name * @param array $attributes * * @return \Layout\Block */ public function createBlock($class, $name = '', array $attributes = []) { try { $block = $this->_getBlockInstance($class, $attributes); } catch (Exception $e) { \Log::exception($e); return false; } if (empty($name) || '.' === $name[0]) { $block->setIsAnonymous(true); if (!empty($name)) { $block->setAnonSuffix(substr($name, 1)); } $name = 'ANONYMOUS_' . sizeof($this->_blocks); } $block->setClass($class); $block->setNameInLayout($name); $block->addData($attributes); $block->setLayout($this); $this->_blocks[$name] = $block; $this->events->fire('layout.block.create.after', ['block' => $block]); return $this->_blocks[$name]; }
<?php include 'vendor/autoload.php'; /** * Illuminate/events * * @source https://github.com/illuminate/events * @contributor https://github.com/angelov */ use App\Events\UserHasRegisteredEvent; use App\Listeners\SendWelcomingEmail; $dispatcher = new \Illuminate\Events\Dispatcher(); // Defining the listeners $dispatcher->listen([UserHasRegisteredEvent::class], SendWelcomingEmail::class); // Firing the event $dispatcher->fire(new UserHasRegisteredEvent("example"));