|
@@ 638-646 (lines=9) @@
|
| 635 |
|
* |
| 636 |
|
* @return \Illuminate\Database\Eloquent\Builder|static |
| 637 |
|
*/ |
| 638 |
|
public function scopeWhereTranslation(Builder $query, $key, $value, $locale = null) |
| 639 |
|
{ |
| 640 |
|
return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
| 641 |
|
$query->where($this->getTranslationsTable().'.'.$key, $value); |
| 642 |
|
if ($locale) { |
| 643 |
|
$query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), $locale); |
| 644 |
|
} |
| 645 |
|
}); |
| 646 |
|
} |
| 647 |
|
|
| 648 |
|
/** |
| 649 |
|
* This scope filters results by checking the translation fields. |
|
@@ 678-686 (lines=9) @@
|
| 675 |
|
* |
| 676 |
|
* @return \Illuminate\Database\Eloquent\Builder|static |
| 677 |
|
*/ |
| 678 |
|
public function scopeWhereTranslationLike(Builder $query, $key, $value, $locale = null) |
| 679 |
|
{ |
| 680 |
|
return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) { |
| 681 |
|
$query->where($this->getTranslationsTable().'.'.$key, 'LIKE', $value); |
| 682 |
|
if ($locale) { |
| 683 |
|
$query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), 'LIKE', $locale); |
| 684 |
|
} |
| 685 |
|
}); |
| 686 |
|
} |
| 687 |
|
|
| 688 |
|
/** |
| 689 |
|
* This scope filters results by checking the translation fields. |