Beispiel #1
0
 /**
  * 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);
 }
 /**
  * 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())]));
 }
Beispiel #3
0
 /**
  * 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);
 }
 /**
  * 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);
 }
 /**
  * @param HostnameRepositoryContract $hostname
  * @param ResponseFactory            $response
  * @return \Illuminate\Http\JsonResponse
  */
 public function ajax(HostnameRepositoryContract $hostname, ResponseFactory $response)
 {
     return $response->json($hostname->ajaxQuery('hostname'));
 }
 public function handle(ResponseFactory $response)
 {
     return $response->json($this->content, $this->status, $this->headers, $this->options);
 }
Beispiel #7
0
 public function handle(ResponseFactory $factory)
 {
     $response = ['data' => $this->content, 'status' => $this->status];
     return $factory->json($response, $this->status, $this->headers, $this->options);
 }
Beispiel #8
0
 /**
  * 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);
 }
 /**
  * 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]);
 }
 public function handle(Larasponse $larasponse, ResponseFactory $response)
 {
     $item = $larasponse->item($this->data, $this->transformer);
     return $response->json($item, $this->status, $this->headers, $this->options);
 }