public function index(PaginationRequest $request)
 {
     $offset = $request->offset();
     $limit = $request->limit();
     $users = $this->userRepository->get('id', 'desc', $offset, $limit);
     return view('pages.admin.users.index', ['users' => $users, 'offset' => $offset, 'limit' => $limit]);
 }
 public function __construct($transformer, $object, PaginationRequest $request, $merge = false)
 {
     parent::__construct($transformer, $object, $merge);
     $this->responseBody = new Collection(['jsonapi' => '1.0']);
     $this->setTransformer($transformer);
     $this->request = $request;
     if ($object) {
         Paginator::currentPageResolver(function () {
             return $this->request->input(join('.', [$this->pageName, $this->pageNumberAttr]), 1);
         });
         $this->model = $this->parseSort($object);
         $this->initIncludes();
         if ($request->getPagination()) {
             $this->pagination = $this->model->paginate($request->input(join('.', [$this->pageName, $this->pageSizeAttr]), 10));
         }
         $this->model = $request->getPagination() ? $this->pagination->getCollection() : $this->model->get();
     }
 }