/** * Registers global middleware for the CMS API. * * @return $this */ protected function registerCmsApiGroupMiddleware() { $this->router->middlewareGroup($this->getConfiguredApiGroupName(), []); foreach ($this->getGlobalApiMiddleware() as $middleware) { // Don't add if the middleware is already globally enabled in the kernel if ($this->kernel->hasMiddleware($middleware)) { continue; } $this->router->pushMiddlewareToGroup($this->getConfiguredApiGroupName(), $middleware); } return $this; }