@@ 479-486 (lines=8) @@ | ||
476 | * |
|
477 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
478 | */ |
|
479 | public function scopeTranslatedIn(Builder $query, $locale = null) |
|
480 | { |
|
481 | $locale = $locale ?: $this->locale(); |
|
482 | ||
483 | return $query->whereHas('translations', function (Builder $q) use ($locale) { |
|
484 | $q->where($this->getLocaleKey(), '=', $locale); |
|
485 | }); |
|
486 | } |
|
487 | ||
488 | /** |
|
489 | * @param \Illuminate\Database\Eloquent\Builder $query |
|
@@ 494-501 (lines=8) @@ | ||
491 | * |
|
492 | * @return \Illuminate\Database\Eloquent\Builder|static |
|
493 | */ |
|
494 | public function scopeNotTranslatedIn(Builder $query, $locale = null) |
|
495 | { |
|
496 | $locale = $locale ?: $this->locale(); |
|
497 | ||
498 | return $query->whereDoesntHave('translations', function (Builder $q) use ($locale) { |
|
499 | $q->where($this->getLocaleKey(), '=', $locale); |
|
500 | }); |
|
501 | } |
|
502 | ||
503 | /** |
|
504 | * @param \Illuminate\Database\Eloquent\Builder $query |