Example #1
0
 /**
  * @param int $perPage
  * @return mixed
  */
 public function paginate($perPage = 15, array $with = array())
 {
     $this->addWithCriteria($with);
     $this->applyCriteria();
     $result = $this->model->paginate($perPage);
     $this->refresh();
     return $result;
 }
 public function getAllPaginated($with = [], $perPage = 10)
 {
     if (isset($with) && !empty($with)) {
         if (!is_array($with)) {
             throw new InvalidArgumentException();
         }
         return $this->model->with($with)->latest()->paginate($perPage);
     }
     return $this->model->paginate($perPage);
 }
Example #3
0
 /**
  * Base fetch for all repository returns
  * This should be used when returning multiple records
  *
  * @param  Model $model - update model instance
  * @return Illuminate\Database\Eloquent\Collection
  */
 public function fetch($model = null)
 {
     if (!is_null($model)) {
         $this->model = $model;
     }
     $result = $this->paginated && is_int($this->paginated) ? $this->model->paginate($this->paginated) : $this->model->get();
     if ($this->paginated) {
         // Append custom query string to page links to maintain correct url filter and sorting
         $result = $result->appends($this->buildUrlQuery());
     }
     $this->reset();
     return $result;
 }
Example #4
0
 /**
  * Retrieve all data of modal, paginated.
  *
  * @param null  $limit
  * @param array $columns
  *
  * @return mixed
  */
 public function paginate($limit = null, $columns = ['*'])
 {
     $limit = is_null($limit) ? config('modal.pagination.limit', 15) : $limit;
     $results = $this->model->paginate($limit, $columns);
     $this->resetModel();
     return $results;
 }
 /**
  * Retrieve all data of repository, paginated
  *
  * @param null  $limit
  * @param array $columns
  * @return mixed
  */
 public function paginate($limit = null, $columns = ['*'])
 {
     return $this->wrap(function ($limit = null, $columns = ['*']) {
         $limit = is_null($limit) ? $this->perPage : $limit;
         return $this->model->paginate($limit, $columns);
     }, new Action(__METHOD__, func_get_args(), Action::READ));
 }
Example #6
0
 /**
  * Return a paginated list of results.
  *
  * @param int|string $amount
  * @param int|string $page
  * @param int|string $perPage
  * @return array
  * @throws ModelNotSetException
  */
 public function paginate($amount, $page, $perPage)
 {
     if (!$this->model) {
         throw new ModelNotSetException('You must set a model to be used by the eloquent driver.');
     }
     return $this->model->paginate($amount, $this->select, $this->key)->all();
 }
Example #7
0
 /**
  * Retrieve all data of repository, paginated
  * @param null $limit
  * @param array $columns
  * @return mixed
  */
 public function paginate($limit = null, $columns = array('*'))
 {
     $this->applyCriteria();
     $limit = is_null($limit) ? config('warehouse.pagination.limit', 15) : $limit;
     $results = $this->model->paginate($limit, $columns);
     return $this->parserResult($results);
 }
Example #8
0
 /**
  * Retrieve all data of repository, paginated.
  *
  * @param null  $limit
  * @param array $columns
  *
  * @return mixed
  */
 public function paginate($limit = null, array $columns = ['*'])
 {
     $this->applyCriteria()->applyOrder();
     $limit = $limit ?: config('repository.pagination.limit', 15);
     $results = $this->model->paginate($limit, $columns);
     $this->makeModel();
     return $this->parseResult($results);
 }
Example #9
0
 /**
  * Retrieve all data of repository, paginated.
  *
  * @param null  $limit
  * @param array $columns
  *
  * @return mixed
  */
 public function paginate($limit = null, $columns = ['*'])
 {
     $this->applyCriteria();
     $this->applyScope();
     $limit = is_null($limit) ? config('repository.pagination.limit', 15) : $limit;
     $results = $this->model->paginate($limit, $columns);
     $this->resetModel();
     return $this->parserResult($results);
 }
 /**
  * Custom Paginate current results, for queries that cannot be paginated using paginate().
  *
  * @param int $total
  * @param int $per_page
  *
  * @return LengthAwarePaginator
  */
 public function customPaginate($total, $per_page = 20)
 {
     $this->per_page = $per_page;
     $this->buildQuery();
     $current_page = Paginator::resolveCurrentPage() ? Paginator::resolveCurrentPage() : 1;
     $data = $this->query->paginate($per_page)->items();
     $pagination = new LengthAwarePaginator($data, $total, $per_page, $current_page, ['path' => Paginator::resolveCurrentPath()]);
     return $pagination;
 }
Example #11
0
 /**
  * @param null $perPage
  * @param array $columns
  *
  * @return mixed
  */
 public function paginate($perPage = null, $columns = ['*'])
 {
     $this->eagerLoading();
     $this->applyCriteria();
     $perPage = is_null($perPage) ? config('repository.pagination.perPage', 25) : $perPage;
     $results = $this->model->paginate($perPage, $columns);
     $this->resetModel();
     return $this->parseResult($results);
 }
 /**
  * @param int    $limit
  * @param array  $columns
  * @param string $pageName
  * @return mixed
  */
 public function paginate($limit = 15, $columns = ['*'], $pageName = 'page')
 {
     $this->applyBoot();
     $this->applyScopes();
     $this->applyCriteria();
     $result = $this->model->paginate($limit, $columns, $pageName);
     $this->cleanRepository();
     return $result;
 }
Example #13
0
 /**
  * Retrieve all data of modal, paginated.
  *
  * @param null  $limit
  * @param array $columns
  *
  * @return mixed
  */
 public function paginate($limit = null, $columns = ['*'])
 {
     $limit = is_null($limit) ? config('modal.pagination.limit', 15) : $limit;
     if ($this->userFilter) {
         $userId = User::users('id');
         $results = $this->model->whereUserId($userId)->paginate($limit, $columns);
     } else {
         $results = $this->model->paginate($limit, $columns);
     }
     $this->resetModel();
     return $results;
 }
Example #14
0
 /**
  * Paginates the entity
  *
  * @return \Illuminate\Pagination\LengthAwarePaginator
  */
 public function paginate(int $items = null) : LengthAwarePaginator
 {
     $items = is_null($items) ? $this->paginates : $items;
     return $this->entity->paginate($items);
 }
Example #15
0
 /**
  * Return all rows paginate by value of $perPage
  * @param int $perPage
  * @param array $columns
  * @return mixed
  */
 public function paginate($perPage = 10, $columns = array('*'))
 {
     return $this->model->paginate($perPage, $columns);
 }
 /**
  * Return paginated results.
  *
  * @param int $perPage Number of results per page
  *
  * @return static
  */
 public function paginate($perPage = 10)
 {
     return $this->model->paginate($perPage);
 }
Example #17
0
 /**
  * Render response to display list of $data
  *
  * @param Repository|Model $data
  * @param string $view
  * @return Response
  */
 protected function defaultIndex($data, $view)
 {
     $var = camel_case(explode('.', $view)[1] . 's');
     ${$var} = $data->paginate(15);
     return view($view, compact($var));
 }
Example #18
0
 /**
  * 翻页
  * @param int $perPage
  * @param string $pageName
  * @param int|null $page
  * @return static
  */
 public function paginate(int $perPage, string $pageName = 'page', int $page = null)
 {
     $this->original->paginate($perPage, ['*'], $pageName, $page);
     return $this;
 }
 public function index()
 {
     $perPage = \Config::get('laravel-rbac.rolesPerPage', 10);
     $list = $this->roleModel->paginate($perPage);
     return view('aliukevicius/laravelRbac::roles.index', compact('list', 'urlPart'));
 }
 public function getAllPaginated($count)
 {
     return $this->model->paginate($count);
 }
 public function paginate($recordPerPage = 10)
 {
     $this->data = $this->model->paginate($recordPerPage);
     return $this;
 }
 /**
  * Paginate the results of the model.
  * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
  */
 public function paginate()
 {
     return $this->model->paginate();
 }
Example #23
0
 /**
  * 翻页
  * @param int $perPage
  * @param int|null $page
  * @return AbstractPaginator
  */
 protected function createPaginator(int $perPage, int $page = null) : AbstractPaginator
 {
     return $this->original->paginate($perPage, ['*'], 'page', $page);
 }