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