Dimsav\Translatable\Translatable::scopeWhereTranslationLike PHP Method

scopeWhereTranslationLike() public method

This scope filters results by checking the translation fields.
public scopeWhereTranslationLike ( Builder $query, string $key, string $value, string $locale = null ) : Builder | static
$query Illuminate\Database\Eloquent\Builder
$key string
$value string
$locale string
return Illuminate\Database\Eloquent\Builder | static
    public function scopeWhereTranslationLike(Builder $query, $key, $value, $locale = null)
    {
        return $query->whereHas('translations', function (Builder $query) use($key, $value, $locale) {
            $query->where($this->getTranslationsTable() . '.' . $key, 'LIKE', $value);
            if ($locale) {
                $query->where($this->getTranslationsTable() . '.' . $this->getLocaleKey(), 'LIKE', $locale);
            }
        });
    }