| @@ 496-504 (lines=9) @@ | ||
| 493 | * @param array $columns |
|
| 494 | * @return mixed |
|
| 495 | */ |
|
| 496 | public function findByField($field, $value = null, $columns = ['*']) |
|
| 497 | { |
|
| 498 | $this->applyCriteria(); |
|
| 499 | $this->applyScope(); |
|
| 500 | $model = $this->model->where($field, '=', $value)->get($columns); |
|
| 501 | $this->resetModel(); |
|
| 502 | ||
| 503 | return $this->parserResult($model); |
|
| 504 | } |
|
| 505 | ||
| 506 | /** |
|
| 507 | * Find data by slug. |
|
| @@ 558-565 (lines=8) @@ | ||
| 555 | * @param array $columns |
|
| 556 | * @return mixed |
|
| 557 | */ |
|
| 558 | public function findWhereIn($field, array $values, $columns = ['*']) |
|
| 559 | { |
|
| 560 | $this->applyCriteria(); |
|
| 561 | $model = $this->model->whereIn($field, $values)->get($columns); |
|
| 562 | $this->resetModel(); |
|
| 563 | ||
| 564 | return $this->parserResult($model); |
|
| 565 | } |
|
| 566 | ||
| 567 | /** |
|
| 568 | * Find data by excluding multiple values in one field. |
|
| @@ 575-582 (lines=8) @@ | ||
| 572 | * @param array $columns |
|
| 573 | * @return mixed |
|
| 574 | */ |
|
| 575 | public function findWhereNotIn($field, array $values, $columns = ['*']) |
|
| 576 | { |
|
| 577 | $this->applyCriteria(); |
|
| 578 | $model = $this->model->whereNotIn($field, $values)->get($columns); |
|
| 579 | $this->resetModel(); |
|
| 580 | ||
| 581 | return $this->parserResult($model); |
|
| 582 | } |
|
| 583 | ||
| 584 | /** |
|
| 585 | * Create a new instance in repository. |
|