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