Skip to content

Commit f82e85d

Browse files
Meilisearch: support filtering with backed enums (#759)
* Meilisearch: support filtering with backed enums * Update composer.json --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent c5bda21 commit f82e85d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Engines/MeilisearchEngine.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Laravel\Scout\Engines;
44

5+
use BackedEnum;
56
use Illuminate\Support\LazyCollection;
67
use Laravel\Scout\Builder;
78
use Laravel\Scout\Jobs\RemoveableScoutCollection;
@@ -172,6 +173,10 @@ protected function filters(Builder $builder)
172173
return sprintf('%s=%s', $key, $value ? 'true' : 'false');
173174
}
174175

176+
if ($value instanceof BackedEnum) {
177+
return sprintf('%s=%s', $key, $value->value);
178+
}
179+
175180
return is_numeric($value)
176181
? sprintf('%s=%s', $key, $value)
177182
: sprintf('%s="%s"', $key, $value);

0 commit comments

Comments
 (0)