public static function redirect($route, $to, $name = null, $middleware = null)
    {
        $target = function () use ($to) {
            if (!filter_var($to, FILTER_VALIDATE_URL)) {
                $to = static::getInstance()->route($to);
            }

            return redirect($to, 301);
        };

        return static::all($route, $target, $name, $middleware);
    }
public static function redirect($route, $to, $name = null, $middleware = null)
    {
        $target = function () use ($to) {
            if (!filter_var($to, FILTER_VALIDATE_URL)) {
                $to = static::getInstance()->route($to);
            }

            return redirect($to, 301);
        };

        return static::all($route, $target, $name, $middleware);
    }
public static function redirect ( $ route , $ to , $ name = null , $ middleware = null ) { $ target = function ( ) use ( $ to ) { if ( ! filter_var ( $ to , FILTER_VALIDATE_URL ) ) { $ to = static :: getInstance ( ) -> route ( $ to ) ; } return redirect ( $ to , 301 ) ; } ; return static :: all ( $ route , $ target , $ name , $ middleware ) ; }
Permanently redirect route to another route or URL.

@param string $route Request route
@param mixed $to Route or URL to redirect to
@param string $name (Optional) name of route
@param string|array $middleware (Optional) Middleware

@return Route
@throws Exception
Permanently redirect route to another route or URL .