public function saveI18N()
    {
        if (empty($this->i18n_data)) return;
        $this->i18n_relation()->getQuery()->whereIn($this->getI18NCodeField(), array_keys($this->i18n_data))->delete();
        foreach ($this->i18n_data as $locale => $data) {
            $obj                             = new $this->i18n_class();
            $data[$this->i18n_primary]       = $this->id;
            $data[$this->getI18NCodeField()] = $locale;
            $obj->create($data);
        }
    }
public function saveI18N()
    {
        if (empty($this->i18n_data)) return;
        $this->i18n_relation()->getQuery()->whereIn($this->getI18NCodeField(), array_keys($this->i18n_data))->delete();
        foreach ($this->i18n_data as $locale => $data) {
            $obj                             = new $this->i18n_class();
            $data[$this->i18n_primary]       = $this->id;
            $data[$this->getI18NCodeField()] = $locale;
            $obj->create($data);
        }
    }
public function saveI18N ( ) { if ( empty ( $ this -> i18n_data ) ) return ; $ this -> i18n_relation ( ) -> getQuery ( ) -> whereIn ( $ this -> getI18NCodeField ( ) , array_keys ( $ this -> i18n_data ) ) -> delete ( ) ; foreach ( $ this -> i18n_data as $ locale => $ data ) { $ obj = new $ this -> i18n_class ( ) ; $ data [ $ this -> i18n_primary ] = $ this -> id ; $ data [ $ this -> getI18NCodeField ( ) ] = $ locale ; $ obj -> create ( $ data ) ; } }
Store I18N to database
Store I18N to database