public function prepareTranslations(&$request)
    {
        $translations = [];

        // Translatable Fields
        $transFields = $this->getTranslatableAttributes();

        foreach ($transFields as $field) {
            $trans = json_decode($request->input($field.'_i18n'), true);

            // Set the default local value
            $request->merge([$field => $trans[config('admin.multilingual.default', 'en')]]);

            $translations[$field] = $this->setAttributeTranslations(
                $field,
                $trans
            );

            // Remove field hidden input
            unset($request[$field.'_i18n']);
        }

        // Remove language selector input
        unset($request['i18n_selector']);

        return $translations;
    }
public function prepareTranslations(&$request)
    {
        $translations = [];

        // Translatable Fields
        $transFields = $this->getTranslatableAttributes();

        foreach ($transFields as $field) {
            $trans = json_decode($request->input($field.'_i18n'), true);

            // Set the default local value
            $request->merge([$field => $trans[config('admin.multilingual.default', 'en')]]);

            $translations[$field] = $this->setAttributeTranslations(
                $field,
                $trans
            );

            // Remove field hidden input
            unset($request[$field.'_i18n']);
        }

        // Remove language selector input
        unset($request['i18n_selector']);

        return $translations;
    }
public function prepareTranslations ( & $ request ) { $ translations = [ ] ; // Translatable Fields $ transFields = $ this -> getTranslatableAttributes ( ) ; foreach ( $ transFields as $ field ) { $ trans = json_decode ( $ request -> input ( $ field . '_i18n' ) , true ) ; // Set the default local value $ request -> merge ( [ $ field => $ trans [ config ( 'admin.multilingual.default' , 'en' ) ] ] ) ; $ translations [ $ field ] = $ this -> setAttributeTranslations ( $ field , $ trans ) ; // Remove field hidden input unset ( $ request [ $ field . '_i18n' ] ) ; } // Remove language selector input unset ( $ request [ 'i18n_selector' ] ) ; return $ translations ; }
Prepare translations and set default locale field value.

@param object $request

@return array translations
Prepare translations and set default locale field value .