|
@@ 600-608 (lines=9) @@
|
| 597 |
|
* |
| 598 |
|
* @return \Illuminate\Database\Eloquent\Builder|static |
| 599 |
|
*/ |
| 600 |
|
public function scopeWhereTranslation(Builder $query, $key, $value, $locale = null) |
| 601 |
|
{ |
| 602 |
|
return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
| 603 |
|
$query->where($this->getTranslationsTable().'.'.$key, $value); |
| 604 |
|
if ($locale) { |
| 605 |
|
$query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), $locale); |
| 606 |
|
} |
| 607 |
|
}); |
| 608 |
|
} |
| 609 |
|
|
| 610 |
|
/** |
| 611 |
|
* This scope filters results by checking the translation fields. |
|
@@ 620-628 (lines=9) @@
|
| 617 |
|
* |
| 618 |
|
* @return \Illuminate\Database\Eloquent\Builder|static |
| 619 |
|
*/ |
| 620 |
|
public function scopeWhereTranslationLike(Builder $query, $key, $value, $locale = null) |
| 621 |
|
{ |
| 622 |
|
return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
| 623 |
|
$query->where($this->getTranslationsTable().'.'.$key, 'LIKE', $value); |
| 624 |
|
if ($locale) { |
| 625 |
|
$query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), 'LIKE', $locale); |
| 626 |
|
} |
| 627 |
|
}); |
| 628 |
|
} |
| 629 |
|
|
| 630 |
|
/** |
| 631 |
|
* @return array |