/** * Determine if the daemon should process on this iteration. * * @return bool */ protected function daemonShouldRun() { if ($this->manager->isDownForMaintenance()) { return false; } return $this->events->until('illuminate.queue.looping') !== false; }
/** * Get a custom relationship. * * @param mixed $model * @param string $name * @return Relationship|null */ protected function getCustomRelationship($model, $name) { $relationship = static::$dispatcher->until(new GetApiRelationship($this, $name, $model)); if ($relationship && !$relationship instanceof Relationship) { throw new LogicException('GetApiRelationship handler must return an instance of ' . Relationship::class); } return $relationship; }
/** * Call the given route filter. * * @param string $filter * @param array $parameters * @param \Illuminate\Routing\Route $route * @param \Illuminate\Http\Request $request * @param \Illuminate\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)); }
/** * Get a custom relationship. * * @param string $name * @return BuilderInterface|null */ protected function getCustomRelationship($name) { $builder = static::$dispatcher->until(new GetApiRelationship($this, $name)); if ($builder && !$builder instanceof BuilderInterface) { throw new LogicException('GetApiRelationship handler must return an instance of ' . BuilderInterface::class); } return $builder; }
/** * Determine if the daemon should process on this iteration. * * @return bool */ protected function daemonShouldRun() { if ($this->manager->isDownForMaintenance() || $this->events->until('illuminate.queue.looping') === false) { // If the application is down for maintenance or doesn't want the queues to run // we will sleep for one second just in case the developer has it set to not // sleep at all. This just prevents CPU from maxing out in this situation. $this->sleep(1); return false; } return true; }
/** * Call the given route filter. * * @param string $filter * @param array $parameters * @param \Illuminate\Routing\Route $route * @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Response|null $response * @return mixed * * @deprecated since version 5.1. */ public function callRouteFilter($filter, $parameters, $route, $request, $response = null) { $data = array_merge([$route, $request, $response], $parameters); return $this->events->until('router.filter: ' . $filter, $this->cleanFilterParameters($data)); }
/** * Fire the namespaced validating event. * * @param \Illuminate\Database\Eloquent\Model $model * @param string $event * @return mixed */ protected function fireSluggingEvent(Model $model, $event) { return $this->events->until('eloquent.slugging: ' . get_class($model), [$model, $event]); }