/** * 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); }
/** * 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); } }
/** * Register an authentication attempt event listener. * * @param mixed $callback * @return void */ public function attempting($callback) { if ($this->events) { $this->events->listen('auth.attempt', $callback); } }
/** * 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); } }
/** * 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)); }
/** * 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); }