@@ 556-564 (lines=9) @@ | ||
553 | * |
|
554 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
555 | */ |
|
556 | public function scopeWhereTranslation(Builder $query, $key, $value, $locale = null) |
|
557 | { |
|
558 | return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
559 | $query->where($this->getTranslationsTable().'.'.$key, $value); |
|
560 | if ($locale) { |
|
561 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), $locale); |
|
562 | } |
|
563 | }); |
|
564 | } |
|
565 | ||
566 | /** |
|
567 | * This scope filters results by checking the translation fields. |
|
@@ 576-584 (lines=9) @@ | ||
573 | * |
|
574 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
575 | */ |
|
576 | public function scopeWhereTranslationLike(Builder $query, $key, $value, $locale = null) |
|
577 | { |
|
578 | return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
|
579 | $query->where($this->getTranslationsTable().'.'.$key, 'LIKE', $value); |
|
580 | if ($locale) { |
|
581 | $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), 'LIKE', $locale); |
|
582 | } |
|
583 | }); |
|
584 | } |
|
585 | ||
586 | /** |
|
587 | * @return array |