Skip to content

Commit fe6b1eb

Browse files
authored
Merge pull request #23 from Weebly/where-not-in
Where not in
2 parents be43a35 + 9dced44 commit fe6b1eb

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

src/Database/EloquentBuilder.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,14 @@ public function whereIn($column, $values, $boolean = 'and', $not = false)
122122
return $this;
123123
}
124124

125+
/**
126+
* {@inheritdoc}
127+
*/
128+
public function whereNotIn($column, $values, $boolean = 'and')
129+
{
130+
return $this->whereIn($column, $values, $boolean, true);
131+
}
132+
125133
/**
126134
* {@inheritdoc}
127135
*/

tests/Integration/BelongsToManyMutatedTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
/**
1313
* @group integration
14+
* @group mysql
1415
*/
1516
class BelongsToManyMutatedTest extends TestCase
1617
{

tests/Integration/MutatorTest.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,6 @@ public function test_non_mutated_columns()
108108
$this->assertEquals($id, $p->id);
109109
}
110110

111-
/**
112-
* @group debug
113-
*
114-
* @return void
115-
*/
116111
public function test_where_in()
117112
{
118113
$id = Uuid::uuid1()->toString();
@@ -123,6 +118,16 @@ public function test_where_in()
123118
$this->assertEquals(2, $p->count());
124119
}
125120

121+
public function test_where_not_in()
122+
{
123+
$id = Uuid::uuid1()->toString();
124+
$id2 = Uuid::uuid1()->toString();
125+
$model = (new TestModel())->create(['id' => $id, 'name' => 'A chair']);
126+
$model2 = (new TestModel())->create(['id' => $id2, 'name' => 'A table']);
127+
$p = $model->whereNotIn('id', [$id])->get();
128+
$this->assertEquals(1, $p->count());
129+
}
130+
126131
public function test_where_key()
127132
{
128133
$id = Uuid::uuid1()->toString();

0 commit comments

Comments
 (0)