@@ 579-587 (lines=9) @@ | ||
576 | * |
|
577 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
578 | */ |
|
579 | public function scopeWhereTranslation(Builder $query, $key, $value, $locale = null) |
|
580 | { |
|
581 | return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
582 | $query->where($this->getTranslationsTable().'.'.$key, $value); |
|
583 | if ($locale) { |
|
584 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), $locale); |
|
585 | } |
|
586 | }); |
|
587 | } |
|
588 | ||
589 | /** |
|
590 | * This scope filters results by checking the translation fields. |
|
@@ 599-607 (lines=9) @@ | ||
596 | * |
|
597 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
598 | */ |
|
599 | public function scopeWhereTranslationLike(Builder $query, $key, $value, $locale = null) |
|
600 | { |
|
601 | return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
602 | $query->where($this->getTranslationsTable().'.'.$key, 'LIKE', $value); |
|
603 | if ($locale) { |
|
604 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), 'LIKE', $locale); |
|
605 | } |
|
606 | }); |
|
607 | } |
|
608 | ||
609 | /** |
|
610 | * @return array |