Dimsav\Translatable\Translatable::deleteTranslations PHP Method

deleteTranslations() public method

Deletes all translations for this model.
public deleteTranslations ( string | array | null $locales = null )
$locales string | array | null The locales to be deleted (array or single string) (e.g., ["en", "de"] would remove these translations).
    public function deleteTranslations($locales = null)
    {
        if ($locales === null) {
            $this->translations()->delete();
        } else {
            $locales = (array) $locales;
            $this->translations()->whereIn($this->getLocaleKey(), $locales)->delete();
        }
        // we need to manually "reload" the collection built from the relationship
        // otherwise $this->translations()->get() would NOT be the same as $this->translations
        $this->load('translations');
    }