@@ 602-610 (lines=9) @@ | ||
599 | * |
|
600 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
601 | */ |
|
602 | public function scopeWhereTranslation(Builder $query, $key, $value, $locale = null) |
|
603 | { |
|
604 | return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
605 | $query->where($this->getTranslationsTable().'.'.$key, $value); |
|
606 | if ($locale) { |
|
607 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), $locale); |
|
608 | } |
|
609 | }); |
|
610 | } |
|
611 | ||
612 | /** |
|
613 | * This scope filters results by checking the translation fields. |
|
@@ 642-650 (lines=9) @@ | ||
639 | * |
|
640 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
641 | */ |
|
642 | public function scopeWhereTranslationLike(Builder $query, $key, $value, $locale = null) |
|
643 | { |
|
644 | return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
645 | $query->where($this->getTranslationsTable().'.'.$key, 'LIKE', $value); |
|
646 | if ($locale) { |
|
647 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), 'LIKE', $locale); |
|
648 | } |
|
649 | }); |
|
650 | } |
|
651 | ||
652 | /** |
|
653 | * This scope filters results by checking the translation fields. |