Esempio n. 1
0
 /**
  * Execute the registered Adapters and return a processed response.
  *
  * @return array
  */
 public function execute()
 {
     // Fire the CRON Event and retrieve the results.
     $responses = $this->events->fire('cron.execute');
     // Extract the not null items from the responses.
     $result = array_filter($responses, function ($value) {
         return !is_null($value);
     });
     return $result;
 }
Esempio n. 2
0
 /**
  * Call the given route filter.
  *
  * @param  string  $filter
  * @param  array  $parameters
  * @param  \Nova\Routing\Route  $route
  * @param  \Nova\Http\Request  $request
  * @param  \Nova\Http\Response|null $response
  * @return mixed
  */
 public function callRouteFilter($filter, $parameters, $route, $request, $response = null)
 {
     if (!$this->filtering) {
         return null;
     }
     $data = array_merge(array($route, $request, $response), $parameters);
     return $this->events->until('router.filter: ' . $filter, $this->cleanFilterParameters($data));
 }
Esempio n. 3
0
 /**
  * Fires a log event.
  *
  * @param  string  $level
  * @param  string  $message
  * @param  array   $context
  * @return void
  */
 protected function fireLogEvent($level, $message, array $context = array())
 {
     // If the event dispatcher is set, we will pass along the parameters to the
     // log listeners. These are useful for building profilers or other tools
     // that aggregate all of the log messages for a given "request" cycle.
     if (isset($this->dispatcher)) {
         $this->dispatcher->fire('nova.log', compact('level', 'message', 'context'));
     }
 }
Esempio n. 4
0
 /**
  * Send a Swift Message instance.
  *
  * @param  \Swift_Message  $message
  * @return void
  */
 protected function sendSwiftMessage($message)
 {
     if ($this->events) {
         $this->events->fire('mailer.sending', array($message));
     }
     if (!$this->pretending) {
         $this->swift->send($message, $this->failedRecipients);
     } else {
         if (isset($this->logger)) {
             $this->logMessage($message);
         }
     }
 }
Esempio n. 5
0
 /**
  * Log the user out of the application.
  *
  * @return void
  */
 public function logout()
 {
     $user = $this->user();
     // If we have an event dispatcher instance, we can fire off the logout event
     // so any further processing can be done. This allows the developer to be
     // listening for anytime a user signs out of this application manually.
     $this->clearUserDataFromStorage();
     if (!is_null($this->user)) {
         $this->refreshRememberToken($user);
     }
     if (isset($this->events)) {
         $this->events->fire('auth.logout', array($user));
     }
     // Once we have fired the logout event we will clear the users out of memory
     // so they are no longer available as the user is no longer considered as
     // being signed into this application and should not be available here.
     $this->user = null;
     $this->loggedOut = true;
 }
Esempio n. 6
0
 /**
  * Register a model event with the dispatcher.
  *
  * @param  string  $event
  * @param  \Closure|string  $callback
  * @return void
  */
 protected static function registerModelEvent($event, $callback)
 {
     if (isset(static::$dispatcher)) {
         $name = get_called_class();
         static::$dispatcher->listen("orm.{$event}: {$name}", $callback);
     }
 }
Esempio n. 7
0
 /**
  * Fire an event for this connection.
  *
  * @param  string  $event
  * @return void
  */
 protected function fireConnectionEvent($event)
 {
     if (isset($this->events)) {
         $this->events->fire('connection.' . $this->getName() . '.' . $event, $this);
     }
 }