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