Code Duplication    Length = 9-9 lines in 4 locations

src/Translatable/Translatable.php 4 locations

@@ 607-615 (lines=9) @@
604
     *
605
     * @return \Illuminate\Database\Eloquent\Builder|static
606
     */
607
    public function scopeWhereTranslation(Builder $query, $key, $value, $locale = null)
608
    {
609
        return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) {
610
            $query->where($this->getTranslationsTable().'.'.$key, $value);
611
            if ($locale) {
612
                $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), $locale);
613
            }
614
        });
615
    }
616
617
    /**
618
     * This scope filters results by checking the translation fields.
@@ 627-635 (lines=9) @@
624
     *
625
     * @return \Illuminate\Database\Eloquent\Builder|static
626
     */
627
    public function scopeOrWhereTranslation(Builder $query, $key, $value, $locale = null)
628
    {
629
        return $query->orWhereHas('translations', function (Builder $query) use ($key, $value, $locale) {
630
            $query->where($this->getTranslationsTable().'.'.$key, $value);
631
            if ($locale) {
632
                $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), $locale);
633
            }
634
        });
635
    }
636
637
    /**
638
     * This scope filters results by checking the translation fields.
@@ 647-655 (lines=9) @@
644
     *
645
     * @return \Illuminate\Database\Eloquent\Builder|static
646
     */
647
    public function scopeWhereTranslationLike(Builder $query, $key, $value, $locale = null)
648
    {
649
        return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) {
650
            $query->where($this->getTranslationsTable().'.'.$key, 'LIKE', $value);
651
            if ($locale) {
652
                $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), 'LIKE', $locale);
653
            }
654
        });
655
    }
656
657
    /**
658
     * This scope filters results by checking the translation fields.
@@ 667-675 (lines=9) @@
664
     *
665
     * @return \Illuminate\Database\Eloquent\Builder|static
666
     */
667
    public function scopeOrWhereTranslationLike(Builder $query, $key, $value, $locale = null)
668
    {
669
        return $query->orWhereHas('translations', function (Builder $query) use ($key, $value, $locale) {
670
            $query->where($this->getTranslationsTable().'.'.$key, 'LIKE', $value);
671
            if ($locale) {
672
                $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), 'LIKE', $locale);
673
            }
674
        });
675
    }
676
677
    /**
678
     * This scope sorts results by the given translation field.