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