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


PHP Model::whereIn方法代码示例

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


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

示例1: findWhereIn

 /**
  * Find data by multiple values in one field
  *
  * @param       $field
  * @param array $values
  * @param array $columns
  *
  * @return mixed
  */
 public function findWhereIn($field, array $values, $columns = ['*'])
 {
     $this->applyCriteria();
     $model = $this->model->whereIn($field, $values)->get($columns);
     $this->resetModel();
     return $this->parserResult($model);
 }
开发者ID:mammutgroup,项目名称:l5-repository,代码行数:16,代码来源:BaseRepository.php

示例2: whereIn

 /**
  * Find data by multiple values in one field
  *
  * @param       $field
  * @param array $values
  *
  * @return mixed
  */
 public function whereIn($field, array $values)
 {
     $this->applyCriteria();
     $this->model = $this->model->whereIn($field, $values);
     return $this;
     //return $this->parserResult($model);
 }
开发者ID:eaglesistemas,项目名称:eaglerepository,代码行数:15,代码来源:BaseRepository.php

示例3: whereIn

 /**
  * Add whereIn condition for next query.
  *
  * @param string $column
  * @param array  $value
  *
  * @return void
  */
 public function whereIn($column, array $value)
 {
     $this->model = $this->model->whereIn($column, $value);
     return $this;
 }
开发者ID:LavaliteCms,项目名称:Example,代码行数:13,代码来源:BaseRepository.php

示例4: whereIn

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

示例5: map

 /**
  * Map the given results to instances of the given model.
  *
  * @param  mixed  $results
  * @param  \Illuminate\Database\Eloquent\Model  $model
  * @return Collection
  */
 public function map($results, $model)
 {
     if (count($results['hits']['total']) === 0) {
         return Collection::make();
     }
     $keys = collect($results['hits']['hits'])->pluck('_id')->values()->all();
     $models = $model->whereIn($model->getKeyName(), $keys)->get()->keyBy($model->getKeyName());
     return collect($results['hits']['hits'])->map(function ($hit) use($model, $models) {
         return $models[$hit['_id']];
     });
 }
开发者ID:ericktamayo,项目名称:laravel-scout-elastic,代码行数:18,代码来源:ElasticsearchEngine.php

示例6: byIds

 /**
  * Get multi model by ids
  *
  * @param string slug
  * @return object object of model
  */
 public function byIds($ids)
 {
     return $this->model->whereIn('_id', $ids)->get();
 }
开发者ID:avin,项目名称:shop,代码行数:10,代码来源:EloquentBaseRepository.php

示例7: whereIn

 /**
  * Get list record from list data
  * @param $field
  * @param array $data
  * @return mixed
  */
 public function whereIn($field, $data = array())
 {
     return $this->model->whereIn($field, $data);
 }
开发者ID:vnzacky,项目名称:dog,代码行数:10,代码来源:EloquentBaseRepository.php

示例8: scopeWhereInSubQuery

 /**
  * @param EloquentBuilder|QueryBuilder|Model $query
  * @param string $column
  * @param EloquentBuilder|QueryBuilder|Model $subQuery
  * @param string $subQueryColumn
  *
  * @return QueryBuilder
  */
 public function scopeWhereInSubQuery($query, $column, $subQuery, $subQueryColumn)
 {
     if (!Str::contains($column, '.')) {
         /** @var Model|BetterEloquentTrait $model */
         $model = $query->getModel();
         $column = $model->getField($column);
     }
     $subQuery = $subQuery->toSubQuery($subQueryColumn, true);
     return $query->whereIn($column, $subQuery);
 }
开发者ID:brazenvoid,项目名称:better-eloquent,代码行数:18,代码来源:BetterEloquentTrait.php


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