Пример #1
0
 /**
  * Get processed data
  *
  * @param bool|false $object
  * @return array
  */
 private function getProcessedData($object = false)
 {
     $processor = new DataProcessor($this->results(), $this->columnDef, $this->templates, $this->request['start']);
     return $processor->process($object);
 }
Пример #2
0
 /**
  * Render json response.
  *
  * @param bool $object
  * @return \Illuminate\Http\JsonResponse
  */
 public function render($object = false)
 {
     $processor = new DataProcessor($this->results(), $this->columnDef, $this->templates);
     $data = $processor->process($object);
     $output = ['draw' => (int) $this->request['draw'], 'recordsTotal' => $this->totalRecords, 'recordsFiltered' => $this->filteredRecords];
     if (isset($this->transformer)) {
         $fractal = new Manager();
         $resource = new Collection($data, new $this->transformer());
         $collection = $fractal->createData($resource)->toArray();
         $output['data'] = $collection['data'];
     } else {
         $output['data'] = Helper::transform($data);
     }
     if ($this->isDebugging()) {
         $output = $this->showDebugger($output);
     }
     return new JsonResponse($output);
 }