public function save(array $options = array()) { if (!$this->exists()) { parent::save(); } $langs = Languages::all(); foreach ($langs as $lang) { $translation = Translations::find($this->table . "_" . $this->id . "_" . strtolower($lang->code)); if ($lang->code == Config::get('cms.currlang.code') || !isset($translation->exists)) { //check if translation exists if (isset($translation->exists)) { } else { $translation = new Translations(); } $translation->id = $this->table . "_" . $this->id . "_" . strtolower($lang->code); $translation->translation = json_encode($this->getAttributes()); $translation->save(); } } return; }