Example #1
0
 /**
  * Return a new JSON response from the application.
  * Inject some headers
  *
  * @param  string|array  $data
  * @param  int    $status
  * @param  array  $headers
  * @return \Illuminate\Http\JsonResponse
  */
 public static function collectionJson($data = array(), $status = 200, array $headers = array())
 {
     $collection = new Collection($data);
     $etag = $collection->getEtags();
     if (!empty($etag)) {
         $headers['ETag'] = $etag;
     }
     unset($collection);
     return self::json($data, $status, $headers);
 }