Code Duplication    Length = 13-13 lines in 2 locations

src/Translatable/Translatable.php 2 locations

@@ 655-667 (lines=13) @@
652
     * @param mixed $locales The locales to be deleted (array or single string)
653
     *                       (e.g., ["en", "de"] would remove these translations).
654
     */
655
    public function forgetTranslation($locales)
656
    {
657
        if (!is_array($locales)) {
658
            $locales = [$locales];
659
        }
660
661
        $modelTranslation = $this->getTranslationModelName();
662
        $modelTranslation::where($this->getRelationKey(), '=', $this->id)->whereIn($this->getLocaleKey(), $locales)->delete();
663
664
        // we need to manually "reload" the collection built from the relationship
665
        // otherwise $this->translations()->get() would NOT be the same as $this->translations
666
        $this->load('translations');
667
    }
668
669
    /**
670
     * Deletes the translations for this model, which are not listed in $locales.
@@ 675-687 (lines=13) @@
672
     * @param mixed $locales The locales to be left untouched (array or single string)
673
     *                       (e.g., ["en", "de"] would remove all locales but these).
674
     */
675
    public function syncTranslations($locales)
676
    {
677
        if (!is_array($locales)) {
678
            $locales = [$locales];
679
        }
680
681
        $modelTranslation = $this->getTranslationModelName();
682
        $modelTranslation::where($this->getRelationKey(), '=', $this->id)->whereNotIn($this->getLocaleKey(), $locales)->delete();
683
684
        // we need to manually "reload" the collection built from the relationship
685
        // otherwise $this->translations()->get() would NOT be the same as $this->translations
686
        $this->load('translations');
687
    }
688
}
689