當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。