@@ 573-581 (lines=9) @@ | ||
570 | * |
|
571 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
572 | */ |
|
573 | public function scopeWhereTranslation(Builder $query, $key, $value, $locale = null) { |
|
574 | return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
575 | $query->where($this->getTranslationsTable().'.'.$key, $value); |
|
576 | if ($locale) { |
|
577 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), $locale); |
|
578 | } |
|
579 | }); |
|
580 | } |
|
581 | ||
582 | /** |
|
583 | * This scope filters results by checking the translation fields. |
|
584 | * |
|
@@ 611-619 (lines=9) @@ | ||
608 | * |
|
609 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
610 | */ |
|
611 | public function scopeWhereTranslationLike(Builder $query, $key, $value, $locale = null) { |
|
612 | return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
613 | $query->where($this->getTranslationsTable().'.'.$key, 'LIKE', $value); |
|
614 | if ($locale) { |
|
615 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), 'LIKE', $locale); |
|
616 | } |
|
617 | }); |
|
618 | } |
|
619 | ||
620 | /** |
|
621 | * This scope filters results by checking the translation fields. |
|
622 | * |