Skip to content

Commit

Permalink
Convert static methods to scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
gdebrauwer authored and freekmurze committed Jun 20, 2023
1 parent 888c4bf commit 2794a16
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/HasTranslations.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,14 @@ public function locales(): array
);
}

public static function whereLocale(string $column, string $locale): Builder
public function scopeWhereLocale(Builder $query, string $column, string $locale): void
{
return static::query()->whereNotNull("{$column}->{$locale}");
$query->whereNotNull("{$column}->{$locale}");
}

public static function whereLocales(string $column, array $locales): Builder
public function scopeWhereLocales(Builder $query, string $column, array $locales): void
{
return static::query()->where(function (Builder $query) use ($column, $locales) {
$query->where(function (Builder $query) use ($column, $locales) {
foreach ($locales as $locale) {
$query->orWhereNotNull("{$column}->{$locale}");
}
Expand Down

0 comments on commit 2794a16

Please sign in to comment.