@@ 609-617 (lines=9) @@ | ||
606 | * |
|
607 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
608 | */ |
|
609 | public function scopeWhereTranslation(Builder $query, $key, $value, $locale = null) |
|
610 | { |
|
611 | return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
612 | $query->where($this->getTranslationsTable().'.'.$key, $value); |
|
613 | if ($locale) { |
|
614 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), $locale); |
|
615 | } |
|
616 | }); |
|
617 | } |
|
618 | ||
619 | /** |
|
620 | * This scope filters results by checking the translation fields. |
|
@@ 629-637 (lines=9) @@ | ||
626 | * |
|
627 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
628 | */ |
|
629 | public function scopeOrWhereTranslation(Builder $query, $key, $value, $locale = null) |
|
630 | { |
|
631 | return $query->orWhereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
632 | $query->where($this->getTranslationsTable().'.'.$key, $value); |
|
633 | if ($locale) { |
|
634 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), $locale); |
|
635 | } |
|
636 | }); |
|
637 | } |
|
638 | ||
639 | /** |
|
640 | * This scope filters results by checking the translation fields. |
|
@@ 649-657 (lines=9) @@ | ||
646 | * |
|
647 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
648 | */ |
|
649 | public function scopeWhereTranslationLike(Builder $query, $key, $value, $locale = null) |
|
650 | { |
|
651 | return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
652 | $query->where($this->getTranslationsTable().'.'.$key, 'LIKE', $value); |
|
653 | if ($locale) { |
|
654 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), 'LIKE', $locale); |
|
655 | } |
|
656 | }); |
|
657 | } |
|
658 | ||
659 | /** |
|
660 | * This scope filters results by checking the translation fields. |
|
@@ 669-677 (lines=9) @@ | ||
666 | * |
|
667 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
668 | */ |
|
669 | public function scopeOrWhereTranslationLike(Builder $query, $key, $value, $locale = null) |
|
670 | { |
|
671 | return $query->orWhereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
672 | $query->where($this->getTranslationsTable().'.'.$key, 'LIKE', $value); |
|
673 | if ($locale) { |
|
674 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), 'LIKE', $locale); |
|
675 | } |
|
676 | }); |
|
677 | } |
|
678 | ||
679 | /** |
|
680 | * @return array |