Code Duplication    Length = 9-9 lines in 4 locations

src/Translatable/Translatable.php 4 locations

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