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