public static function createFrom(self $from, $to = null)
    {
        $request = $to ?: new static;

        $files = $from->files->all();

        $files = is_array($files) ? array_filter($files) : $files;

        $request->initialize(
            $from->query->all(),
            $from->request->all(),
            $from->attributes->all(),
            $from->cookies->all(),
            $files,
            $from->server->all(),
            $from->getContent()
        );

        $request->headers->replace($from->headers->all());

        $request->setJson($from->json());

        if ($session = $from->getSession()) {
            $request->setLaravelSession($session);
        }

        $request->setUserResolver($from->getUserResolver());

        $request->setRouteResolver($from->getRouteResolver());

        return $request;
    }
public static function createFrom(self $from, $to = null)
    {
        $request = $to ?: new static;

        $files = $from->files->all();

        $files = is_array($files) ? array_filter($files) : $files;

        $request->initialize(
            $from->query->all(),
            $from->request->all(),
            $from->attributes->all(),
            $from->cookies->all(),
            $files,
            $from->server->all(),
            $from->getContent()
        );

        $request->headers->replace($from->headers->all());

        $request->setJson($from->json());

        if ($session = $from->getSession()) {
            $request->setLaravelSession($session);
        }

        $request->setUserResolver($from->getUserResolver());

        $request->setRouteResolver($from->getRouteResolver());

        return $request;
    }
public static function createFrom ( self $ from , $ to = null ) { $ request = $ to ? : new static ; $ files = $ from -> files -> all ( ) ; $ files = is_array ( $ files ) ? array_filter ( $ files ) : $ files ; $ request -> initialize ( $ from -> query -> all ( ) , $ from -> request -> all ( ) , $ from -> attributes -> all ( ) , $ from -> cookies -> all ( ) , $ files , $ from -> server -> all ( ) , $ from -> getContent ( ) ) ; $ request -> headers -> replace ( $ from -> headers -> all ( ) ) ; $ request -> setJson ( $ from -> json ( ) ) ; if ( $ session = $ from -> getSession ( ) ) { $ request -> setLaravelSession ( $ session ) ; } $ request -> setUserResolver ( $ from -> getUserResolver ( ) ) ; $ request -> setRouteResolver ( $ from -> getRouteResolver ( ) ) ; return $ request ; }
Create a new request instance from the given Laravel request.

@param  \Illuminate\Http\Request  $from
@param  \Illuminate\Http\Request|null  $to
@return static
Create a new request instance from the given Laravel request .