area17 / twill

Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. Chat with us on Discord at https://discord.gg/cnWk7EFv8R.
https://twillcms.com
Apache License 2.0
3.71k stars 567 forks source link

Allow case-insensitive search for translated models for postgres #2528

Closed zeezo887 closed 3 months ago

zeezo887 commented 5 months ago

Description

This PR overrides the scopeOrWhereTranslationLike method of astrotomic/laravel-translatable to select the like operator based on the database driver used.

public function scopeOrWhereTranslationLike(Builder $query, string $translationField, $value, ?string $locale = null): Builder
{
    return $this->scopeWhereTranslation($query, $translationField, $value, $locale, 'orWhereHas', getLikeOperator());
}

Related Issues

Fixes #2112