@@ 644-652 (lines=9) @@ | ||
641 | * |
|
642 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
643 | */ |
|
644 | public function scopeWhereTranslation(Builder $query, $key, $value, $locale = null) |
|
645 | { |
|
646 | return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
647 | $query->where($this->getTranslationsTable().'.'.$key, $value); |
|
648 | if ($locale) { |
|
649 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), $locale); |
|
650 | } |
|
651 | }); |
|
652 | } |
|
653 | ||
654 | /** |
|
655 | * This scope filters results by checking the translation fields. |
|
@@ 684-692 (lines=9) @@ | ||
681 | * |
|
682 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
683 | */ |
|
684 | public function scopeWhereTranslationLike(Builder $query, $key, $value, $locale = null) |
|
685 | { |
|
686 | return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
687 | $query->where($this->getTranslationsTable().'.'.$key, 'LIKE', $value); |
|
688 | if ($locale) { |
|
689 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), 'LIKE', $locale); |
|
690 | } |
|
691 | }); |
|
692 | } |
|
693 | ||
694 | /** |
|
695 | * This scope filters results by checking the translation fields. |