@@ 623-631 (lines=9) @@ | ||
620 | * |
|
621 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
622 | */ |
|
623 | public function scopeWhereTranslation(Builder $query, $key, $value, $locale = null) |
|
624 | { |
|
625 | return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
626 | $query->where($this->getTranslationsTable().'.'.$key, $value); |
|
627 | if ($locale) { |
|
628 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), $locale); |
|
629 | } |
|
630 | }); |
|
631 | } |
|
632 | ||
633 | /** |
|
634 | * This scope filters results by checking the translation fields. |
|
@@ 643-651 (lines=9) @@ | ||
640 | * |
|
641 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
642 | */ |
|
643 | public function scopeOrWhereTranslation(Builder $query, $key, $value, $locale = null) |
|
644 | { |
|
645 | return $query->orWhereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
646 | $query->where($this->getTranslationsTable().'.'.$key, $value); |
|
647 | if ($locale) { |
|
648 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), $locale); |
|
649 | } |
|
650 | }); |
|
651 | } |
|
652 | ||
653 | /** |
|
654 | * This scope filters results by checking the translation fields. |
|
@@ 663-671 (lines=9) @@ | ||
660 | * |
|
661 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
662 | */ |
|
663 | public function scopeWhereTranslationLike(Builder $query, $key, $value, $locale = null) |
|
664 | { |
|
665 | return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
666 | $query->where($this->getTranslationsTable().'.'.$key, 'LIKE', $value); |
|
667 | if ($locale) { |
|
668 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), 'LIKE', $locale); |
|
669 | } |
|
670 | }); |
|
671 | } |
|
672 | ||
673 | /** |
|
674 | * This scope filters results by checking the translation fields. |
|
@@ 683-691 (lines=9) @@ | ||
680 | * |
|
681 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
682 | */ |
|
683 | public function scopeOrWhereTranslationLike(Builder $query, $key, $value, $locale = null) |
|
684 | { |
|
685 | return $query->orWhereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
686 | $query->where($this->getTranslationsTable().'.'.$key, 'LIKE', $value); |
|
687 | if ($locale) { |
|
688 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), 'LIKE', $locale); |
|
689 | } |
|
690 | }); |
|
691 | } |
|
692 | ||
693 | /** |
|
694 | * @return array |