| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6b461ca commit e0c7d76
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,6 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | 3 | namespace Illuminate\Validation; | |
| 4 | 4 | ||
| 5 | + use Illuminate\Support\Str; | ||
| 5 | 6 | use Illuminate\Database\ConnectionResolverInterface; | |
| 6 | 7 | ||
| 7 | 8 | class DatabasePresenceVerifier implements PresenceVerifierInterface | |
@@ -91,6 +92,8 @@ protected function addWhere($query, $key, $extraValue) | |||
| 91 | 92 | $query->whereNull($key); | |
| 92 | 93 | } elseif ($extraValue === 'NOT_NULL') { | |
| 93 | 94 | $query->whereNotNull($key); | |
| 95 | + } elseif (Str::startsWith($extraValue, '!')) { | ||
| 96 | + $query->where($key, '!=', mb_substr($extraValue, 1)); | ||
| 94 | 97 | } else { | |
| 95 | 98 | $query->where($key, $extraValue); | |
| 96 | 99 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,11 +16,12 @@ public function testBasicCount() | |||
| 16 | 16 | $db->shouldReceive('connection')->once()->with('connection')->andReturn($conn = m::mock('StdClass')); | |
| 17 | 17 | $conn->shouldReceive('table')->once()->with('table')->andReturn($builder = m::mock('StdClass')); | |
| 18 | 18 | $builder->shouldReceive('where')->with('column', '=', 'value')->andReturn($builder); | |
| 19 | - $extra = ['foo' => 'NULL', 'bar' => 'NOT_NULL', 'baz' => 'taylor', 'faz' => true]; | ||
| 19 | + $extra = ['foo' => 'NULL', 'bar' => 'NOT_NULL', 'baz' => 'taylor', 'faz' => true, 'not' => '!admin']; | ||
| 20 | 20 | $builder->shouldReceive('whereNull')->with('foo'); | |
| 21 | 21 | $builder->shouldReceive('whereNotNull')->with('bar'); | |
| 22 | 22 | $builder->shouldReceive('where')->with('baz', 'taylor'); | |
| 23 | 23 | $builder->shouldReceive('where')->with('faz', true); | |
| 24 | + $builder->shouldReceive('where')->with('not', '!=', 'admin'); | ||
| 24 | 25 | $builder->shouldReceive('count')->once()->andReturn(100); | |
| 25 | 26 | ||
| 26 | 27 | $this->assertEquals(100, $verifier->getCount('table', 'column', 'value', null, null, $extra)); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments