vaened /
laravel-searcher
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Created by enea dhack - 20/06/2020 19:38. |
||
| 4 | */ |
||
| 5 | |||
| 6 | namespace Vaened\Searcher\Constraints; |
||
| 7 | |||
| 8 | use Illuminate\Database\Eloquent\Builder; |
||
| 9 | use Vaened\Searcher\Constraint; |
||
| 10 | |||
| 11 | class In implements Constraint |
||
| 12 | { |
||
| 13 | private array $values; |
||
| 14 | |||
| 15 | private string $column; |
||
| 16 | |||
| 17 | public function __construct(array $values, string $column) |
||
| 18 | { |
||
| 19 | $this->values = $values; |
||
| 20 | $this->column = $column; |
||
| 21 | } |
||
| 22 | |||
| 23 | public function condition(Builder $builder): Builder |
||
| 24 | { |
||
| 25 | return $builder->whereIn($this->column, $this->values); |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 26 | } |
||
| 27 | } |
||
| 28 |