本文整理汇总了PHP中Illuminate\Database\Eloquent\Builder::offset方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::offset方法的具体用法?PHP Builder::offset怎么用?PHP Builder::offset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Eloquent\Builder
的用法示例。
在下文中一共展示了Builder::offset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applyOffset
/**
* @param $value
* @return $this
*/
public function applyOffset($value)
{
/**
* Save to conditons.
*/
$this->addCondition('offset', $value);
$this->model = $this->model->offset($value);
return $this;
}
示例2: build
public function build()
{
$request = $this->request;
$needle = $request->needle();
if ($needle && $request->searchable) {
$this->qb->where(function ($subQB) use($needle, $request) {
foreach ($request->searchable as $column) {
$subQB->orWhere($column, 'LIKE', "%{$needle}%");
}
});
}
$request->modifyQuery($this->qb);
$this->qb->orderBy($request->orderBy(), $request->sortBy());
$count = $this->qb->count();
$this->qb->take($request->perPage());
$this->qb->offset($request->offset());
$paginator = new LengthAwarePaginator($request->items($this->qb), $count, $request->perPage(), $request->page());
$paginator->request = $request;
$paginator->appends($request->query());
$this->paginator = $paginator;
}
示例3: forPage
/**
* @param $page
* @param $itemsPerPage
*
* @return $this
*/
public function forPage($page, $itemsPerPage)
{
$this->specificationQuery->offset(($page - 1) * $itemsPerPage)->limit($itemsPerPage);
return $this;
}
示例4: apply
/**
* @param Builder $table
*
* @return Builder
*/
public function apply(Builder $table)
{
return $table->offset(($this->currentPage - 1) * $this->itemsPerPage)->limit($this->itemsPerPage);
}