当前位置: 首页>>代码示例>>PHP>>正文


PHP Model::get方法代码示例

本文整理汇总了PHP中Illuminate\Database\Eloquent\Model::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::get方法的具体用法?PHP Model::get怎么用?PHP Model::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Database\Eloquent\Model的用法示例。


在下文中一共展示了Model::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 /**
  * Get records from the database.
  *
  * @param int $per_page
  *
  * @return Collection
  */
 public function get($per_page = 20)
 {
     $this->per_page = $per_page;
     $this->buildQuery();
     return $this->query->get();
 }
开发者ID:bhutanio,项目名称:laravel-utilities,代码行数:13,代码来源:DbRepository.php

示例2: results

 /**
  * Get the results for the model.
  *
  * @return array
  * @throws ModelNotSetException
  */
 public function results()
 {
     if (!$this->model) {
         throw new ModelNotSetException('You must set a model to be used by the eloquent driver.');
     }
     return $this->model->get($this->select)->all();
 }
开发者ID:michaeljennings,项目名称:carpenter,代码行数:13,代码来源:Eloquent.php

示例3: all

 /**
  * @param array $with
  * @return Collection
  */
 public function all(array $with = array())
 {
     $this->addWithCriteria($with);
     $this->applyCriteria();
     $result = $this->model->get();
     $this->refresh();
     return $result;
 }
开发者ID:ablunier,项目名称:laravel-database,代码行数:12,代码来源:Repository.php

示例4: all

 /**
  * Return all instances of the model.
  *
  * @param array $columns
  * return \Illuminate\Database\Eloquent\Model
  */
 public function all($columns = array('*'))
 {
     $key = snake_case(class_basename($this) . '_' . __FUNCTION__);
     if (Cache::has($key)) {
         return Cache::get($key);
     }
     $result = $this->model->get($columns);
     Cache::add($key, $result, env('APP_CACHE_MINUTES'));
     return $result;
 }
开发者ID:ritey,项目名称:absolutemini,代码行数:16,代码来源:AbstractRepository.php

示例5: fetch

 /**
  * 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;
 }
开发者ID:thinktomorrow,项目名称:repo,代码行数:20,代码来源:BaseRepository.php

示例6: findWhere

 /**
  * Find data by multiple fields
  *
  * @param array $where
  * @param array $columns
  * @return mixed|Model
  */
 public function findWhere(array $where, $columns = ['*'])
 {
     return $this->wrap(function ($where, $columns = ['*']) {
         $this->applyWhere($where);
         return $this->model->get($columns);
     }, new Action(__METHOD__, func_get_args(), Action::READ));
 }
开发者ID:sandeeprajoria,项目名称:Housekeeper,代码行数:14,代码来源:BaseRepository.php

示例7: getByCriteria

 /**
  * Find data by Criteria
  *
  * @param CriteriaInterface $criteria
  *
  * @return mixed
  */
 public function getByCriteria(CriteriaInterface $criteria)
 {
     $this->model = $criteria->apply($this->model, $this);
     $results = $this->model->get();
     $this->resetModel();
     return $this->parserResult($results);
 }
开发者ID:mammutgroup,项目名称:l5-repository,代码行数:14,代码来源:BaseRepository.php

示例8: all

 /**
  * Retorna todos os registros deste Model.
  *
  * @param array $columns Colunas desejadas no retorno.
  *
  * @return mixed
  */
 public function all($columns = ['*'])
 {
     if (!empty($this->defaultOrderColumn)) {
         return $this->model->orderBy($this->defaultOrderColumn, $this->defaultOrderDirection)->get($columns);
     }
     return $this->model->get($columns);
 }
开发者ID:lfalmeida,项目名称:lbase,代码行数:14,代码来源:Repository.php

示例9: getByCriteria

 /**
  * @param CriteriaInterface|string $criteria
  *
  * @return Collection
  */
 public function getByCriteria($criteria)
 {
     if (is_string($criteria)) {
         $criteria = $this->app->make($criteria);
     }
     $this->model = $criteria->apply($this->model, $this);
     $results = $this->model->get();
     $this->resetModel();
     return $this->parseResult($results);
 }
开发者ID:killtw,项目名称:repository,代码行数:15,代码来源:BaseRepository.php

示例10: get

 /**
  * @param array $columns
  * @return mixed
  */
 public function get($columns = ['*'])
 {
     $this->applyBoot();
     $this->applyScopes();
     $this->applyCriteria();
     if ($this->model instanceof Builder) {
         $results = $this->model->get($columns);
     } else {
         $results = $this->model->all($columns);
     }
     $this->cleanRepository();
     return $results;
 }
开发者ID:guilhermegonzaga,项目名称:repository,代码行数:17,代码来源:Repository.php

示例11: findWhere

 /**
  * Find data by multiple fields.
  *
  * @param array $where
  * @param array $columns
  *
  * @return mixed
  */
 public function findWhere(array $where, $columns = ['*'])
 {
     foreach ($where as $field => $value) {
         if (is_array($value)) {
             list($field, $condition, $val) = $value;
             $this->model = $this->model->where($field, $condition, $val);
         } else {
             $this->model = $this->model->where($field, '=', $value);
         }
     }
     $model = $this->model->get($columns);
     $this->resetModel();
     return $model;
 }
开发者ID:LavaliteCms,项目名称:Example,代码行数:22,代码来源:BaseRepository.php

示例12: getByAdditionalCriterias

 /**
  * Find data by multiple Criterias
  *
  * @param array $criterias
  * @return mixed
  * @public param \Prettus\Repository\Contracts\CriteriaInterface[] $criteria
  */
 public function getByAdditionalCriterias(array $criterias)
 {
     $current_criteria = $this->getCriteria();
     if ($current_criteria) {
         foreach ($current_criteria as $c) {
             if ($c instanceof CriteriaInterface) {
                 $this->model = $c->apply($this->model, $this);
             }
         }
     }
     foreach ($criterias as $c) {
         if ($c instanceof CriteriaInterface) {
             $this->model = $c->apply($this->model, $this);
         }
     }
     $results = $this->model->get();
     $this->resetModel();
     return $this->parserResult($results);
 }
开发者ID:Nethanel,项目名称:l5-repository,代码行数:26,代码来源:BaseRepository.php

示例13: random

 /**
  * @param array $columns
  * @return mixed
  */
 public function random($columns = array('*'))
 {
     return $this->model->get()->random();
 }
开发者ID:Burris19,项目名称:ReposityLaravel,代码行数:8,代码来源:Repository.php

示例14: getIndex

 /**
  * Displays all the items
  */
 public function getIndex()
 {
     $items = $this->model->get();
     return $this->render('index', compact('items'))->with('columns', $this->tableColumns);
 }
开发者ID:dakshhmehta,项目名称:laravel-starter-kit,代码行数:8,代码来源:CRUDController.php

示例15: get

 /**
  * Gets an entity by parameters
  *
  * @return \Illuminate\Database\Eloquent\Collection
  */
 public function get() : Collection
 {
     return $this->entity->get();
 }
开发者ID:prjkt,项目名称:repofuck,代码行数:9,代码来源:Repofuck.php


注:本文中的Illuminate\Database\Eloquent\Model::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。