Skip to content

Commit

Permalink
feat(operator): add operator ilike para consultar com case-insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielrassweiler committed Jun 15, 2022
1 parent 12c0bdb commit 0d2ac9c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/Classes/Illuminate/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,14 @@ private function addBasicWhere($stmt, $argument)
private function checkOperatorAndType(string $operator, string $type)
{
$operators = [
'like' => ['string', 'object', 'composition'],
'=' => ['int', 'string', 'float', 'json', 'date', 'bool', 'boolean', 'object', 'composition'],
'<=' => ['int', 'string', 'float', 'date', 'object', 'composition'],
'<' => ['int', 'string', 'float', 'date', 'object', 'composition'],
'>=' => ['int', 'string', 'float', 'date', 'object', 'composition'],
'>' => ['int', 'string', 'float', 'date', 'object', 'composition'],
'!=' => ['int', 'string', 'float', 'date', 'bool', 'boolean'],
'ilike' => ['string', 'object', 'composition'],
'like' => ['string', 'object', 'composition'],
'=' => ['int', 'string', 'float', 'json', 'date', 'bool', 'boolean', 'object', 'composition'],
'<=' => ['int', 'string', 'float', 'date', 'object', 'composition'],
'<' => ['int', 'string', 'float', 'date', 'object', 'composition'],
'>=' => ['int', 'string', 'float', 'date', 'object', 'composition'],
'>' => ['int', 'string', 'float', 'date', 'object', 'composition'],
'!=' => ['int', 'string', 'float', 'date', 'bool', 'boolean'],
];

return in_array($type, $operators[$operator] ?? []);
Expand Down

0 comments on commit 0d2ac9c

Please sign in to comment.