123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- /**
- * User: Mike
- * Email: m@9026.com
- * Date: 2017/1/12
- * Time: 17:52
- */
- namespace App\Repositories\Base\Criteria;
- use App\Repositories\Base\Criteria;
- use App\Repositories\Contracts\RepositoryInterface as Repository;
- class WhereIn extends Criteria {
- private $field = '';
- private $array = [];
- public function __construct($field, $array=[])
- {
- $this->field = $field;
- $this->array = $array;
- }
- /**
- * @param $model
- * @param RepositoryInterface $repository
- * @return mixed
- */
- public function apply($model, Repository $repository)
- {
- $model = $model->whereIn($this->field,$this->array);
- return $model;
- }
- }
|