public function middlewareGroup($name, array $middlewareNames)
    {
        if ($this->hasMiddleware($name)) {
            $message = "Cannot add middleware group '$name'. A middleware by this name has already been registered.";
            throw new RuntimeException($message);
        }

        foreach ($middlewareNames as $middlewareName) {
            if (!$this->hasMiddleware($middlewareName)) {
                $message = "Cannot add '$middlewareName' middleware to group '$name'. It has not been registered.";
                throw new RuntimeException($message);
            }
        }

        $this->_middlewareGroups[$name] = $middlewareNames;

        return $this;
    }
public function middlewareGroup($name, array $middlewareNames)
    {
        if ($this->hasMiddleware($name)) {
            $message = "Cannot add middleware group '$name'. A middleware by this name has already been registered.";
            throw new RuntimeException($message);
        }

        foreach ($middlewareNames as $middlewareName) {
            if (!$this->hasMiddleware($middlewareName)) {
                $message = "Cannot add '$middlewareName' middleware to group '$name'. It has not been registered.";
                throw new RuntimeException($message);
            }
        }

        $this->_middlewareGroups[$name] = $middlewareNames;

        return $this;
    }
public function middlewareGroup ( $ name , array $ middlewareNames ) { if ( $ this -> hasMiddleware ( $ name ) ) { $ message = "Cannot add middleware group '$name'. A middleware by this name has already been registered." ; throw new RuntimeException ( $ message ) ; } foreach ( $ middlewareNames as $ middlewareName ) { if ( ! $ this -> hasMiddleware ( $ middlewareName ) ) { $ message = "Cannot add '$middlewareName' middleware to group '$name'. It has not been registered." ; throw new RuntimeException ( $ message ) ; } } $ this -> _middlewareGroups [ $ name ] = $ middlewareNames ; return $ this ; }
Add middleware to a middleware group

@param string $name Name of the middleware group
@param array $middlewareNames Names of the middleware
@return $this
Add middleware to a middleware group