Code Duplication    Length = 9-9 lines in 4 locations

src/Translatable/Translatable.php 4 locations

@@ 619-627 (lines=9) @@
616
     *
617
     * @return \Illuminate\Database\Eloquent\Builder|static
618
     */
619
    public function scopeWhereTranslation(Builder $query, $key, $value, $locale = null)
620
    {
621
        return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) {
622
            $query->where($this->getTranslationsTable().'.'.$key, $value);
623
            if ($locale) {
624
                $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), $locale);
625
            }
626
        });
627
    }
628
629
    /**
630
     * This scope filters results by checking the translation fields.
@@ 639-647 (lines=9) @@
636
     *
637
     * @return \Illuminate\Database\Eloquent\Builder|static
638
     */
639
    public function scopeOrWhereTranslation(Builder $query, $key, $value, $locale = null)
640
    {
641
        return $query->orWhereHas('translations', function (Builder $query) use ($key, $value, $locale) {
642
            $query->where($this->getTranslationsTable().'.'.$key, $value);
643
            if ($locale) {
644
                $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), $locale);
645
            }
646
        });
647
    }
648
649
    /**
650
     * This scope filters results by checking the translation fields.
@@ 659-667 (lines=9) @@
656
     *
657
     * @return \Illuminate\Database\Eloquent\Builder|static
658
     */
659
    public function scopeWhereTranslationLike(Builder $query, $key, $value, $locale = null)
660
    {
661
        return $query->whereHas('translations', function (Builder $query) use ($key, $value, $locale) {
662
            $query->where($this->getTranslationsTable().'.'.$key, 'LIKE', $value);
663
            if ($locale) {
664
                $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), 'LIKE', $locale);
665
            }
666
        });
667
    }
668
669
    /**
670
     * This scope filters results by checking the translation fields.
@@ 679-687 (lines=9) @@
676
     *
677
     * @return \Illuminate\Database\Eloquent\Builder|static
678
     */
679
    public function scopeOrWhereTranslationLike(Builder $query, $key, $value, $locale = null)
680
    {
681
        return $query->orWhereHas('translations', function (Builder $query) use ($key, $value, $locale) {
682
            $query->where($this->getTranslationsTable().'.'.$key, 'LIKE', $value);
683
            if ($locale) {
684
                $query->where($this->getTranslationsTable().'.'.$this->getLocaleKey(), 'LIKE', $locale);
685
            }
686
        });
687
    }
688
689
    /**
690
     * This scope sorts results by the given translation field.