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