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


PHP ResponseFactory::json方法代码示例

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


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

示例1: json

 /**
  * Return a new JSON response from the application.
  *
  * @param string|array $data
  * @param int $status
  * @param array $headers
  * @param int $options
  * @return \Illuminate\Http\JsonResponse 
  * @static 
  */
 public static function json($data = array(), $status = 200, $headers = array(), $options = 0)
 {
     return \Illuminate\Routing\ResponseFactory::json($data, $status, $headers, $options);
 }
开发者ID:satriashp,项目名称:tour,代码行数:14,代码来源:_ide_helper.php

示例2: handle

 /**
  * Handle the command.
  *
  * @param ResponseFactory $response
  */
 public function handle(ResponseFactory $response)
 {
     $this->builder->setFormResponse($response->json(['errors' => $this->builder->getFormErrors()->getMessages(), 'redirect' => $this->builder->getFormOption('redirect', $this->builder->getFormActions()->active()->getRedirect())]));
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:9,代码来源:SetJsonResponse.php

示例3: respond

 /**
  * Fire event and return the response
  *
  * @param  string   $event
  * @param  string   $error
  * @param  integer  $status
  * @param  array    $payload
  * @return mixed
  */
 protected function respond($event, $error, $status, $payload = [])
 {
     $response = $this->events->fire($event, $payload, true);
     return $response ?: $this->response->json(['error' => $error], $status);
 }
开发者ID:jasonb8293,项目名称:fox-api,代码行数:14,代码来源:BaseMiddleware.php

示例4: search

 /**
  * Search for books
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function search()
 {
     $books = $this->book->search($this->request->input('q'), $this->getAdvancedQueryInputs(), $this->getOptionInputs());
     return $books !== false ? $this->response->json(['found' => $books]) : $this->response->json(['error' => $this->book->getErrors()], 400);
 }
开发者ID:MLoureiro,项目名称:book-api-trial,代码行数:10,代码来源:BookController.php

示例5: ajax

 /**
  * @param HostnameRepositoryContract $hostname
  * @param ResponseFactory            $response
  * @return \Illuminate\Http\JsonResponse
  */
 public function ajax(HostnameRepositoryContract $hostname, ResponseFactory $response)
 {
     return $response->json($hostname->ajaxQuery('hostname'));
 }
开发者ID:hyn,项目名称:management-interface,代码行数:9,代码来源:HostnameController.php

示例6: handle

 public function handle(ResponseFactory $response)
 {
     return $response->json($this->content, $this->status, $this->headers, $this->options);
 }
开发者ID:vinelab,项目名称:lucid,代码行数:4,代码来源:RespondWithJsonErrorJob.php

示例7: handle

 public function handle(ResponseFactory $factory)
 {
     $response = ['data' => $this->content, 'status' => $this->status];
     return $factory->json($response, $this->status, $this->headers, $this->options);
 }
开发者ID:vinelab,项目名称:lucid,代码行数:5,代码来源:RespondWithJsonJob.php

示例8: respond

 /**
  * Fire event and return the response
  *
  * @param  string   $event
  * @param  string   $error
  * @param  integer  $status
  * @param  array    $payload
  * @return mixed
  */
 protected function respond($event, $error, $status, $payload = [])
 {
     $response = $this->events->fire($event, $payload, true);
     return $response ?: $this->response->json(arrayView('phpsoft.users::errors/authenticate', ['error' => $error]), $status);
 }
开发者ID:wyrover,项目名称:laravel-users,代码行数:14,代码来源:Authenticate.php

示例9: search

 /**
  * Search for the vacancies
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function search()
 {
     $data = $this->vacancy->search($this->request->input('q'), $this->getOptionInputs());
     return $this->response->json(['vacancies' => $data]);
 }
开发者ID:MLoureiro,项目名称:vacancy-repository-trial,代码行数:10,代码来源:VacancyController.php

示例10: handle

 public function handle(Larasponse $larasponse, ResponseFactory $response)
 {
     $item = $larasponse->item($this->data, $this->transformer);
     return $response->json($item, $this->status, $this->headers, $this->options);
 }
开发者ID:jebbdomingo,项目名称:lifestutor2,代码行数:5,代码来源:RespondWithJsonJob.php


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