/** * @return ResponseInterface */ public function ajaxList() { $last = Input::fromQuery('last', -1); $limit = Input::fromQuery('limit', 10); $queryBuilder = $this->repository->orderBy(['id' => false])->limit(0, $limit); if ($last > 0) { $queryBuilder = $queryBuilder->where(['id' => ['<', $last]]); } return Response::ajax($queryBuilder->all()->toArray()); }
/** * @return ResponseInterface */ public function ajaxList() { $categories = $this->repository->orderBy(['id' => true])->all(); return Response::ajax($categories->toArray()); }