public function getTranslations($key = null)
    {
        if ($key !== null) {
            $this->guardAgainstNonTranslatableAttribute($key);

            return array_filter(json_decode($this->getAttributeFromArray($key) ?? '' ?: '{}', true) ?: [], function ($value) {
                return $value !== null && $value !== false && $value !== '';
            });
        }

        return array_reduce($this->getTranslatableAttributes(), function ($result, $item) {
            $result[$item] = $this->getTranslations($item);

            return $result;
        });
    }
public function getTranslations($key = null)
    {
        if ($key !== null) {
            $this->guardAgainstNonTranslatableAttribute($key);

            return array_filter(json_decode($this->getAttributeFromArray($key) ?? '' ?: '{}', true) ?: [], function ($value) {
                return $value !== null && $value !== false && $value !== '';
            });
        }

        return array_reduce($this->getTranslatableAttributes(), function ($result, $item) {
            $result[$item] = $this->getTranslations($item);

            return $result;
        });
    }
public function getTranslations ( $ key = null ) { if ( $ key !== null ) { $ this -> guardAgainstNonTranslatableAttribute ( $ key ) ; return array_filter ( json_decode ( $ this -> getAttributeFromArray ( $ key ) ?? '' ? : '{}' , true ) ? : [ ] , function ( $ value ) { return $ value !== null && $ value !== false && $ value !== '' ; } ) ; } return array_reduce ( $ this -> getTranslatableAttributes ( ) , function ( $ result , $ item ) { $ result [ $ item ] = $ this -> getTranslations ( $ item ) ; return $ result ; } ) ; }
Get the translations for the given key.

@param  string|null  $key

@return array
Get the translations for the given key .