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