Skip to content

Commit

Permalink
[FIX] replace whereJsonContains with where for more database's driver…
Browse files Browse the repository at this point in the history
… compatibility
  • Loading branch information
AbdelrahmanBl authored and freekmurze committed May 13, 2024
1 parent e7e223c commit b75b330
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/HasTranslations.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,14 @@ public function scopeWhereLocales(Builder $query, string $column, array $locales

public function scopeWhereJsonContainsLocale(Builder $query, string $column, string $locale, mixed $value): void
{
$query->whereJsonContains("{$column}->{$locale}", $value);
$query->where("{$column}->{$locale}", $value);
}

public function scopeWhereJsonContainsLocales(Builder $query, string $column, array $locales, mixed $value): void
{
$query->where(function (Builder $query) use ($column, $locales, $value) {
foreach($locales as $locale) {
$query->orWhereJsonContains("{$column}->{$locale}", $value);
$query->orWhere("{$column}->{$locale}", $value);
}
});
}
Expand Down

0 comments on commit b75b330

Please sign in to comment.