original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Create a new request instance from the given Laravel request.
  
  @param  \Illuminate\Http\Request  $from
  @param  \Illuminate\Http\Request|null  $to
  @return static
docstring_tokens: Create a new request instance from the given Laravel request .