Skip to content

Commit

Permalink
Merge pull request #20 from lsst-epo/18-make-wherein-case-insensitive
Browse files Browse the repository at this point in the history
Made `whereIn` and `whereNotIn` args case-ins.
  • Loading branch information
ericdrosas87 authored Oct 10, 2024
2 parents b20bc03 + d4a62ef commit ba60d3c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## 4.5.1 - 2024.9.24
### Fixed
* The `whereIn` and `whereNotIn` argument methods now are case-insensitive

## 4.5.0 - 2024.9.24
### Added
* Assets are uploaded to the currently selected album
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "lsst-epo/canto-dam-assets",
"description": "This Craft CMS plugin adds a Field Type with GraphQL support for the Canto Digital Asset Management (DAM) web system",
"type": "craft-plugin",
"version": "4.5.0",
"version": "4.5.1",
"license": "MIT",
"require": {
"php": ">=8.0.2",
Expand Down
4 changes: 2 additions & 2 deletions src/lib/laravel/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function whereIn($key, $values, $strict = false)
$item = data_get($item, $key);
// Handle the case where the data is an array of items
if (is_array($item)) {
return count(array_intersect($item, $values)) > 0;
return count(array_intersect(array_map('strtolower', $item), array_map('strtolower', $values))) > 0;
}
return in_array($item, $values, $strict);
});
Expand All @@ -98,7 +98,7 @@ public function whereNotIn($key, $values, $strict = false)
$item = data_get($item, $key);
// Handle the case where the data is an array of items
if (is_array($item)) {
return count(array_intersect($item, $values)) > 0;
return count(array_intersect(array_map('strtolower', $item), array_map('strtolower', $values))) > 0;
}
return in_array($item, $values, $strict);
});
Expand Down

0 comments on commit ba60d3c

Please sign in to comment.