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