コード例 #1
0
 /**
  * Register a new callback handler for when
  * a log event is triggered.
  *
  * @param  \Closure  $callback
  * @return void
  *
  * @throws \RuntimeException
  */
 public function listen(Closure $callback)
 {
     if (!isset($this->dispatcher)) {
         throw new \RuntimeException("Events dispatcher has not been set.");
     }
     $this->dispatcher->listen('nova.log', $callback);
 }
コード例 #2
0
 /**
  * Register a database query listener with the connection.
  *
  * @param  \Closure  $callback
  * @return void
  */
 public function listen(Closure $callback)
 {
     if (isset($this->events)) {
         $this->events->listen('nova.query', $callback);
     }
 }
コード例 #3
0
 /**
  * Register an authentication attempt event listener.
  *
  * @param  mixed  $callback
  * @return void
  */
 public function attempting($callback)
 {
     if ($this->events) {
         $this->events->listen('auth.attempt', $callback);
     }
 }
コード例 #4
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);
     }
 }
コード例 #5
0
 /**
  * Register a new Filter with the Router.
  *
  * @param  string  $name
  * @param  string|callable  $callback
  * @return void
  */
 public function filter($name, $callback)
 {
     $this->events->listen('router.filter: ' . $name, $this->parseFilter($callback));
 }
コード例 #6
0
 /**
  * Register a new Adapter with the Manager.
  *
  * @param  string|callable  $callback
  * @param  int     $priority
  * @return void
  */
 public function register($callback, $priority = 0)
 {
     $this->events->listen('cron.execute', $this->parseAdapter($callback), $priority);
 }