public static function group(string $prefix, Closure $closure, $middleware = [])
    {
        $prefix = trim($prefix, self::SEPARATOR);

        //Prepend prefixes
        if ($prefix) {
            self::$prefixGroupStack[] = $prefix;
        }

        //Add group middleware
        if ($middleware) {
            self::$middlewareGroupStack[] = $middleware;
        }

        //Call group closure
        $closure();

        //Remove prefix
        if ($prefix) {
            array_pop(self::$prefixGroupStack);
        }

        //Remove current group middleware from the list
        if ($middleware) {
            array_pop(self::$middlewareGroupStack);
        }
    }
public static function group(string $prefix, Closure $closure, $middleware = [])
    {
        $prefix = trim($prefix, self::SEPARATOR);

        //Prepend prefixes
        if ($prefix) {
            self::$prefixGroupStack[] = $prefix;
        }

        //Add group middleware
        if ($middleware) {
            self::$middlewareGroupStack[] = $middleware;
        }

        //Call group closure
        $closure();

        //Remove prefix
        if ($prefix) {
            array_pop(self::$prefixGroupStack);
        }

        //Remove current group middleware from the list
        if ($middleware) {
            array_pop(self::$middlewareGroupStack);
        }
    }
public static function group ( string $ prefix , Closure $ closure , $ middleware = [ ] ) { $ prefix = trim ( $ prefix , self :: SEPARATOR ) ; //Prepend prefixes if ( $ prefix ) { self :: $ prefixGroupStack [ ] = $ prefix ; } //Add group middleware if ( $ middleware ) { self :: $ middlewareGroupStack [ ] = $ middleware ; } //Call group closure $ closure ( ) ; //Remove prefix if ( $ prefix ) { array_pop ( self :: $ prefixGroupStack ) ; } //Remove current group middleware from the list if ( $ middleware ) { array_pop ( self :: $ middlewareGroupStack ) ; } }
Creates a route group.

@param string       $prefix
@param Closure      $closure
@param array|string $middleware
Creates a route group .