public function group(closure $callback)
    {
        if ($this->can_proceed()) {
            // If this is a top level group.
            if ($this->is_group === false) {
                $this->is_group = true;

                $callback();

                $this->is_group = false;
                $this->shortcircuit = false;
            } else {
                $callback();
                // As this is a nested group, remove this level's middleware.
                $this->middleware = \array_diff($this->middleware, $this->last_middleware);

                $this->last_middleware = [];
            }
        }

        return $this;
    }
public function group(closure $callback)
    {
        if ($this->can_proceed()) {
            // If this is a top level group.
            if ($this->is_group === false) {
                $this->is_group = true;

                $callback();

                $this->is_group = false;
                $this->shortcircuit = false;
            } else {
                $callback();
                // As this is a nested group, remove this level's middleware.
                $this->middleware = \array_diff($this->middleware, $this->last_middleware);

                $this->last_middleware = [];
            }
        }

        return $this;
    }
public function group ( closure $ callback ) { if ( $ this -> can_proceed ( ) ) { // If this is a top level group. if ( $ this -> is_group === false ) { $ this -> is_group = true ; $ callback ( ) ; $ this -> is_group = false ; $ this -> shortcircuit = false ; } else { $ callback ( ) ; // As this is a nested group, remove this level's middleware. $ this -> middleware = \ array_diff ( $ this -> middleware , $ this -> last_middleware ) ; $ this -> last_middleware = [ ] ; } } return $ this ; }
Groups routes with the current middleware stack.

Useful when you want to apply the same middleware to similar routes,
such as an area restricted by user role.

@since 1.0.0

@param  closure $callback A closure in which the grouped routes are registered.
@return Router
Groups routes with the current middleware stack .