Skip to content

Commit

Permalink
add whereIntegerInRaw (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
harris21 committed Mar 10, 2023
1 parent 01b7a1a commit 4ef0473
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
42 changes: 42 additions & 0 deletions src/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,48 @@ public function whereIn($column, $values, $boolean = 'and', $not = false)
return $this;
}

public function whereIntegerInRaw($column, $values, $boolean = 'and', $not = false)
{
return $this->whereIn($column, $values, $boolean, $not);
}

/**
* Add an "or where in raw" clause for integer values to the query.
*
* @param string $column
* @param \Illuminate\Contracts\Support\Arrayable|array $values
* @return $this
*/
public function orWhereIntegerInRaw($column, $values)
{
return $this->whereIntegerInRaw($column, $values, 'or');
}

/**
* Add a "where not in raw" clause for integer values to the query.
*
* @param string $column
* @param \Illuminate\Contracts\Support\Arrayable|array $values
* @param string $boolean
* @return $this
*/
public function whereIntegerNotInRaw($column, $values, $boolean = 'and')
{
return $this->whereIntegerInRaw($column, $values, $boolean, true);
}

/**
* Add an "or where not in raw" clause for integer values to the query.
*
* @param string $column
* @param \Illuminate\Contracts\Support\Arrayable|array $values
* @return $this
*/
public function orWhereIntegerNotInRaw($column, $values)
{
return $this->whereIntegerNotInRaw($column, $values, 'or');
}

/**
* Add a where between statement to the query.
*
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class Stub extends Model

class TestCase extends PHPUnit
{
public function __construct()
public function __construct(?string $name = null, array $data = [], $dataName = '')
{
parent::__construct();
parent::__construct($name, $data, $dataName);

// load custom configuration file
$this->dbConfig = require 'config/database.php';
Expand Down
2 changes: 1 addition & 1 deletion tests/Vinelab/NeoEloquent/Eloquent/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function testFindWithMany()
$builder->setModel($this->getMockModel());
$builder->shouldReceive('get')->with(['column'])->andReturn('baz');

$result = $builder->find([1, 2], ['column']);
$result = $builder->findMany([1, 2], ['column']);
$this->assertEquals('baz', $result);
}

Expand Down

0 comments on commit 4ef0473

Please sign in to comment.