public function appendLanguageKeys()
    {
        $attributes = $this->getAttributes();
        foreach($attributes as $attrKey => $attr){
            if(isset($this->translatableColumns[$attrKey])) {
                if(is_array($attr)) {
                    continue;
                }
                if($attr == null || $attr == "" || $attr == '[]') {
                    $attr = new \stdClass();
                }else{
                    if(!is_object($attr)) {
                        $attr = json_decode($attr);
                    }
                }
                foreach(Language::all() as $language){
                    $langSlug = $language->slug;

                    if (!isset($attr->$langSlug)) {
                        if($this->translatableColumns[$attrKey] == "string") {
                            $attr->$langSlug = "";
                        }else{
                            $attr->$langSlug = [];
                        }
                    }
                }
                $this->$attrKey = $attr;
            }
        }
        return $this;
    }
public function appendLanguageKeys()
    {
        $attributes = $this->getAttributes();
        foreach($attributes as $attrKey => $attr){
            if(isset($this->translatableColumns[$attrKey])) {
                if(is_array($attr)) {
                    continue;
                }
                if($attr == null || $attr == "" || $attr == '[]') {
                    $attr = new \stdClass();
                }else{
                    if(!is_object($attr)) {
                        $attr = json_decode($attr);
                    }
                }
                foreach(Language::all() as $language){
                    $langSlug = $language->slug;

                    if (!isset($attr->$langSlug)) {
                        if($this->translatableColumns[$attrKey] == "string") {
                            $attr->$langSlug = "";
                        }else{
                            $attr->$langSlug = [];
                        }
                    }
                }
                $this->$attrKey = $attr;
            }
        }
        return $this;
    }
public function appendLanguageKeys ( ) { $ attributes = $ this -> getAttributes ( ) ; foreach ( $ attributes as $ attrKey => $ attr ) { if ( isset ( $ this -> translatableColumns [ $ attrKey ] ) ) { if ( is_array ( $ attr ) ) { continue ; } if ( $ attr == null || $ attr == "" || $ attr == '[]' ) { $ attr = new \ stdClass ( ) ; } else { if ( ! is_object ( $ attr ) ) { $ attr = json_decode ( $ attr ) ; } } foreach ( Language :: all ( ) as $ language ) { $ langSlug = $ language -> slug ; if ( ! isset ( $ attr -> $ langSlug ) ) { if ( $ this -> translatableColumns [ $ attrKey ] == "string" ) { $ attr -> $ langSlug = "" ; } else { $ attr -> $ langSlug = [ ] ; } } } $ this -> $ attrKey = $ attr ; } } return $ this ; }
Add language keys in translatable json columns where a key doesn't exits.

@return $this
@throws \Exception
Add language keys in translatable json columns where a key doesn t exits .