Skip to content

Commit eae84ce

Browse files
add preg_quote to value checks in get Count for Unique validation with regex
1 parent 279b18c commit eae84ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Jenssegers/Mongodb/Validation/DatabasePresenceVerifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class DatabasePresenceVerifier extends \Illuminate\Validation\DatabasePresenceVe
1616
*/
1717
public function getCount($collection, $column, $value, $excludeId = null, $idColumn = null, array $extra = [])
1818
{
19-
$query = $this->table($collection)->where($column, 'regex', "/$value/i");
19+
$query = $this->table($collection)->where($column, 'regex', "/" . preg_quote($value) . "/i");
2020

2121
if ($excludeId !== null && $excludeId != 'NULL') {
2222
$query->where($idColumn ?: 'id', '<>', $excludeId);

0 commit comments

Comments
 (0)