Code Duplication    Length = 13-13 lines in 2 locations

src/Translatable/Translatable.php 2 locations

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