當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Builder::toBase方法代碼示例

本文整理匯總了PHP中Illuminate\Database\Eloquent\Builder::toBase方法的典型用法代碼示例。如果您正苦於以下問題:PHP Builder::toBase方法的具體用法?PHP Builder::toBase怎麽用?PHP Builder::toBase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Database\Eloquent\Builder的用法示例。


在下文中一共展示了Builder::toBase方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: initialize

 /**
  * Initialize
  *
  * @return void
  */
 public function initialize()
 {
     if (!$this->initialized) {
         $query = $this->builder->toBase();
         $sql = $query->toSql();
         $bindings = $query->getBindings();
         $conn = $query->getConnection();
         $this->statement = $conn->getPdo()->prepare($sql);
         $this->statement->execute($conn->prepareBindings($bindings));
         $this->prototype = $this->builder->getModel()->newFromBuilder();
     }
     $this->initialized = true;
 }
開發者ID:naturalweb,項目名稱:nwlaravel,代碼行數:18,代碼來源:BuilderResultset.php

示例2: paginate

 /**
  * Paginate the returned set of models.
  *
  * @param  int      $perPage
  * @param  array    $columns
  * @param  string   $pageName
  * @param  int|null $page
  * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
  *
  * @throws \InvalidArgumentException
  */
 public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
 {
     $query = $this->model->toBase();
     $total = $query->getCountForPagination();
     $model = $this->model->forPage($page = $page ?: Paginator::resolveCurrentPage($pageName), $perPage = $perPage ?: $this->model->getPerPage());
     $results = new LengthAwarePaginator($this->hookPaginate($model->get($columns)), $total, $perPage, $page, ['path' => Paginator::resolveCurrentPath(), 'pageName' => $pageName]);
     $this->reset();
     return $results;
 }
開發者ID:propaganistas,項目名稱:laravel-repository,代碼行數:20,代碼來源:Repository.php

示例3: toBase

 /**
  * Get a base query builder instance.
  *
  * @return \Illuminate\Database\Query\Builder 
  * @static 
  */
 public static function toBase()
 {
     return \Illuminate\Database\Eloquent\Builder::toBase();
 }
開發者ID:andybolano,項目名稱:viaja_seguro,代碼行數:10,代碼來源:_ide_helper.php

示例4: addHasWhere

 /**
  * Add the "has" condition where clause to the query.
  *
  * @param  \Illuminate\Database\Eloquent\Builder  $hasQuery
  * @param  \Illuminate\Database\Eloquent\Relations\Relation  $relation
  * @param  string  $operator
  * @param  int  $count
  * @param  string  $boolean
  * @return \Illuminate\Database\Eloquent\Builder|static
  */
 protected function addHasWhere(Builder $hasQuery, Relation $relation, $operator, $count, $boolean)
 {
     $hasQuery->mergeModelDefinedRelationConstraints($relation->getQuery());
     if ($this->shouldRunExistsQuery($operator, $count)) {
         $not = $operator === '<' && $count === 1;
         return $this->addWhereExistsQuery($hasQuery->toBase(), $boolean, $not);
     }
     return $this->whereCountQuery($hasQuery->toBase(), $operator, $count, $boolean);
 }
開發者ID:levanigongadze,項目名稱:Labweb,代碼行數:19,代碼來源:Builder.php

示例5: parsePagination

 protected function parsePagination(array $params, Query $query)
 {
     $page = isset($params['page']) ? $params['page'] : 1;
     $this->maxPages = (int) ceil($query->toBase()->getCountForPagination() / self::UNITS_PER_PAGE);
     return $query->forPage($page, self::UNITS_PER_PAGE);
 }
開發者ID:xandros15,項目名稱:aigisu,代碼行數:6,代碼來源:UnitSearch.php


注:本文中的Illuminate\Database\Eloquent\Builder::toBase方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。