src/Services/Saver.php
public function sync()
    {
        $this->connection()->transaction(function () {
            foreach ($this->editable() as $field) {
                // get original HTML input
                $field = $field->getInput();

                $name = $field->getName();

                if ($this->isKey($field) || $this->isTranslatable($field) || $this->isMediaFile($field)) {
                    continue;
                }

                $this->collectRelations($field, $name);

                $value = $this->isFile($field) ? $this->request->file($name) : $this->request->get($name);

                $value = $this->isBoolean($field) ? (bool) $value : $value;

                $value = $this->handleJsonType($name, $value);

                $this->data[$name] = $value;
            }

            $this->cleanData();

            $this->collectTranslatable();

            $this->appendTranslationsToRelations();

            Model::unguard();

            /*
            |-------------------------------------------------------
            | Save main data
            |-------------------------------------------------------
            */
            $this->save();

            /*
            |-------------------------------------------------------
            | Relationships
            |-------------------------------------------------------
            | Save related data, fetched by "relation" from related tables
            */
            $this->saveRelations();

            $this->saveMedia();

            Model::reguard();
        });

        return $this->repository;
    }
public function sync()
    {
        $this->connection()->transaction(function () {
            foreach ($this->editable() as $field) {
                // get original HTML input
                $field = $field->getInput();

                $name = $field->getName();

                if ($this->isKey($field) || $this->isTranslatable($field) || $this->isMediaFile($field)) {
                    continue;
                }

                $this->collectRelations($field, $name);

                $value = $this->isFile($field) ? $this->request->file($name) : $this->request->get($name);

                $value = $this->isBoolean($field) ? (bool) $value : $value;

                $value = $this->handleJsonType($name, $value);

                $this->data[$name] = $value;
            }

            $this->cleanData();

            $this->collectTranslatable();

            $this->appendTranslationsToRelations();

            Model::unguard();

            /*
            |-------------------------------------------------------
            | Save main data
            |-------------------------------------------------------
            */
            $this->save();

            /*
            |-------------------------------------------------------
            | Relationships
            |-------------------------------------------------------
            | Save related data, fetched by "relation" from related tables
            */
            $this->saveRelations();

            $this->saveMedia();

            Model::reguard();
        });

        return $this->repository;
    }
public function sync ( ) { $ this -> connection ( ) -> transaction ( function ( ) { foreach ( $ this -> editable ( ) as $ field ) { // get original HTML input $ field = $ field -> getInput ( ) ; $ name = $ field -> getName ( ) ; if ( $ this -> isKey ( $ field ) || $ this -> isTranslatable ( $ field ) || $ this -> isMediaFile ( $ field ) ) { continue ; } $ this -> collectRelations ( $ field , $ name ) ; $ value = $ this -> isFile ( $ field ) ? $ this -> request -> file ( $ name ) : $ this -> request -> get ( $ name ) ; $ value = $ this -> isBoolean ( $ field ) ? ( bool ) $ value : $ value ; $ value = $ this -> handleJsonType ( $ name , $ value ) ; $ this -> data [ $ name ] = $ value ; } $ this -> cleanData ( ) ; $ this -> collectTranslatable ( ) ; $ this -> appendTranslationsToRelations ( ) ; Model :: unguard ( ) ; /*
            |-------------------------------------------------------
            | Save main data
            |-------------------------------------------------------
            */ $ this -> save ( ) ; /*
            |-------------------------------------------------------
            | Relationships
            |-------------------------------------------------------
            | Save related data, fetched by "relation" from related tables
            */ $ this -> saveRelations ( ) ; $ this -> saveMedia ( ) ; Model :: reguard ( ) ; } ) ; return $ this -> repository ; }
Process request and persist data.

@return mixed
Process request and persist data .