@@ 616-624 (lines=9) @@ | ||
613 | * |
|
614 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
615 | */ |
|
616 | public function scopeWhereTranslation(Builder $query, $key, $value, $locale = null) |
|
617 | { |
|
618 | return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
619 | $query->where($this->getTranslationsTable().'.'.$key, $value); |
|
620 | if ($locale) { |
|
621 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), $locale); |
|
622 | } |
|
623 | }); |
|
624 | } |
|
625 | ||
626 | /** |
|
627 | * This scope filters results by checking the translation fields. |
|
@@ 636-644 (lines=9) @@ | ||
633 | * |
|
634 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
635 | */ |
|
636 | public function scopeOrWhereTranslation(Builder $query, $key, $value, $locale = null) |
|
637 | { |
|
638 | return $query->orWhereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
639 | $query->where($this->getTranslationsTable().'.'.$key, $value); |
|
640 | if ($locale) { |
|
641 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), $locale); |
|
642 | } |
|
643 | }); |
|
644 | } |
|
645 | ||
646 | /** |
|
647 | * This scope filters results by checking the translation fields. |
|
@@ 656-664 (lines=9) @@ | ||
653 | * |
|
654 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
655 | */ |
|
656 | public function scopeWhereTranslationLike(Builder $query, $key, $value, $locale = null) |
|
657 | { |
|
658 | return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
659 | $query->where($this->getTranslationsTable().'.'.$key, 'LIKE', $value); |
|
660 | if ($locale) { |
|
661 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), 'LIKE', $locale); |
|
662 | } |
|
663 | }); |
|
664 | } |
|
665 | ||
666 | /** |
|
667 | * This scope filters results by checking the translation fields. |
|
@@ 676-684 (lines=9) @@ | ||
673 | * |
|
674 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
675 | */ |
|
676 | public function scopeOrWhereTranslationLike(Builder $query, $key, $value, $locale = null) |
|
677 | { |
|
678 | return $query->orWhereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
679 | $query->where($this->getTranslationsTable().'.'.$key, 'LIKE', $value); |
|
680 | if ($locale) { |
|
681 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), 'LIKE', $locale); |
|
682 | } |
|
683 | }); |
|
684 | } |
|
685 | ||
686 | /** |
|
687 | * @return array |