当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::create方法代码示例

本文整理汇总了PHP中Illuminate\Support\Facades\Request::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::create方法的具体用法?PHP Request::create怎么用?PHP Request::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Support\Facades\Request的用法示例。


在下文中一共展示了Request::create方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setRequestContext

 /**
  * Set Request context for the package components
  *
  * @param  string $method
  * @param  string $path
  * @param  string $locale
  * @param  array $parameters
  * @param  array $cookies
  * @param  array $files
  * @param  array $server
  * @param  string $content
  * @return Response
  */
 protected function setRequestContext($method, $path, $locale = null, $parameters = [], $cookies = [], $files = [], $server = [], $content = null)
 {
     $uri = $this->getUri($path, $locale);
     $request = Request::create($uri, $method, $parameters, $cookies, $files, $server, $content);
     $this->app->instance('request', $request);
     app('localization.localize')->detectLocale();
     $this->setRoutes();
 }
开发者ID:marianvlad,项目名称:Laravel-Subdomain-Localization,代码行数:21,代码来源:TestCase.php

示例2: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $request = Request::create('/api/blocknotify', 'GET', ['key' => Mint\Settings::getVal('api_key'), 'blockhash' => $this->argument('blockhash')]);
     Request::replace($request->input());
     $response = Route::dispatch($request)->getContent();
     if ($this->option('debug')) {
         $this->info($response);
     }
 }
开发者ID:s1rxploit,项目名称:Mint,代码行数:14,代码来源:ApiBlocknotify.php

示例3: callRoute

 /**
  * Call the given URI and return the Response.
  *
  * @param  string  $method
  * @param  string  $uri
  * @param  array  $parameters
  * @param  array  $cookies
  * @param  array  $files
  * @param  array  $server
  * @param  string  $content
  *
  * @return \Illuminate\Http\Response
  */
 public function callRoute($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null)
 {
     $server = collect(['CONTENT_TYPE' => 'application/json', 'Accept' => 'application/json'])->merge($server)->toArray();
     $request = Request::create($uri, $method, $parameters, $cookies, $files, $this->transformHeadersToServerVars($server), $content);
     $kernel = App::make('Illuminate\\Contracts\\Http\\Kernel');
     $response = $kernel->handle($request);
     $kernel->terminate($request, $response);
     if (file_exists($file = App::bootstrapPath() . '/app.php')) {
         $app = (require $file);
         $app->make('Illuminate\\Contracts\\Console\\Kernel')->bootstrap();
     }
     return $response;
 }
开发者ID:mpociot,项目名称:laravel-apidoc-generator,代码行数:26,代码来源:LaravelGenerator.php

示例4: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Exception               $e
  *
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($this->isHttpException($e)) {
         $code = $e->getStatusCode();
         if ($code !== 500 || App::environment('production') || App::environment('staging')) {
             $page = Page::findByInternalName($code);
             if ($page) {
                 $request = Request::create($page->url()->getLocation(), 'GET');
                 return response(Route::dispatch($request)->getContent(), $code);
             }
         }
     }
     return parent::render($request, $e);
 }
开发者ID:robbytaylor,项目名称:boom-core,代码行数:22,代码来源:Handler.php

示例5: dispatch

 /**
  * Dispatch this request.
  *
  * @param string $method
  * 
  * @return mixed
  */
 public function dispatch($method)
 {
     // Save original input.
     $original_input = Request::input();
     // Create request.
     $request = Request::create($this->uri, $method, $this->params);
     // Replace input (maintain api auth parameters).
     Request::replace(array_merge($request->input(), array('client_id' => Request::input('client_id'), 'client_secret' => Request::input('client_secret'), 'access_token' => Request::input('access_token'))));
     // Dispatch request.
     $response = Route::dispatch($request);
     // Restore original input.
     Request::replace($original_input);
     $content = $response->getContent();
     return empty($content) ? null : json_decode($response->getContent(), true);
 }
开发者ID:mmanos,项目名称:laravel-api,代码行数:22,代码来源:InternalRequest.php

示例6: fastRequest

 protected function fastRequest($uri, $method, $input = array())
 {
     $uri = $this->config['prefix'] . $uri;
     $method = strtoupper($method);
     if ($this->config['local']) {
         $oldInput = Input::all();
         Input::replace($input);
         $request = Request::create($uri, $method, array());
         $response = Route::dispatch($request);
         $content = $response->getContent();
         $code = $response->getStatusCode();
         $results = json_decode($content);
         Input::replace($oldInput);
     } else {
         if ($method === 'GET') {
             $uri .= '?' . urldecode(http_build_query($input));
         }
         $client = new Client($this->config['domain']);
         $request = $client->createRequest($method, $uri, array(), $method === 'GET' ? array() : $input)->addHeader('Content-Type', 'application/json');
         try {
             $response = $request->send();
         } catch (ClientErrorResponseException $e) {
             $response = $e->getResponse();
         }
         $code = $response->getStatusCode();
         $results = $response->json();
     }
     if (!Str::startsWith((string) $code, "2")) {
         throw new ApiException($results, $code);
     }
     return $results;
 }
开发者ID:vespakoen,项目名称:epi,代码行数:32,代码来源:Api.php

示例7: getMethodPatterns

 /**
  * Get the pattern filters for a given URI and method.
  *
  * @param  string $uri
  * @param  string $method
  * @return array
  */
 protected function getMethodPatterns($uri, $method)
 {
     return $this->router->findPatternFilters(Request::create($uri, $method));
 }
开发者ID:aginev,项目名称:acl,代码行数:11,代码来源:RouteList.php

示例8: last_page

 /**
  * @return string
  */
 public function last_page()
 {
     $lang = null;
     $collection = $this->router->getRoutes();
     $route = $collection->match(Request::create($this->wrappedObject->last_page));
     if ($route->getName() != null) {
         $langOptions = $this->getWioData($route->getName(), $route->parameters());
         if (!isset($langOptions['url'])) {
             $langOptions['url'] = route($route->getName(), $route->parameters());
         }
         if (!isset($langOptions['langString'])) {
             $langString = 'online.' . $route->getName();
         } else {
             $langString = 'online.' . $langOptions['langString'];
             unset($langOptions['langString']);
         }
         $lang = $this->translator->get($langString, $langOptions);
         // May happen if we have two routes 'xy.yx.zz' and 'xy.yx'
         if (is_array($lang)) {
             $lang = $this->translator->get($langString . '.index', $langOptions);
         }
     }
     if ($lang == null) {
         //			$lang = Lang::get('online.unknown', ['url' => '']);
         // Used for debugging, should be left here until we have added all routes
         $lang = 'online.' . $route->getName();
     }
     return $lang;
 }
开发者ID:Adamzynoni,项目名称:mybb2,代码行数:32,代码来源:User.php


注:本文中的Illuminate\Support\Facades\Request::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。