public function store(Model $model, array $data)
    {
        if ( ! config('cms-models.transactions')) {
            return $this->storeFormFieldValuesForModel($model, $data);
        }

        // Perform the whole store process in a transaction
        DB::beginTransaction();

        try {

            $success = $this->storeFormFieldValuesForModel($model, $data);

            if ($success) {
                DB::commit();
            } else {
                DB::rollBack();
            }

        } catch (Exception $e) {

            DB::rollBack();

            throw $e;
        }

        return $success;
    }
public function store(Model $model, array $data)
    {
        if ( ! config('cms-models.transactions')) {
            return $this->storeFormFieldValuesForModel($model, $data);
        }

        // Perform the whole store process in a transaction
        DB::beginTransaction();

        try {

            $success = $this->storeFormFieldValuesForModel($model, $data);

            if ($success) {
                DB::commit();
            } else {
                DB::rollBack();
            }

        } catch (Exception $e) {

            DB::rollBack();

            throw $e;
        }

        return $success;
    }
public function store ( Model $ model , array $ data ) { if ( ! config ( 'cms-models.transactions' ) ) { return $ this -> storeFormFieldValuesForModel ( $ model , $ data ) ; } // Perform the whole store process in a transaction DB :: beginTransaction ( ) ; try { $ success = $ this -> storeFormFieldValuesForModel ( $ model , $ data ) ; if ( $ success ) { DB :: commit ( ) ; } else { DB :: rollBack ( ) ; } } catch ( Exception $ e ) { DB :: rollBack ( ) ; throw $ e ; } return $ success ; }
Stores submitted form field data on a model.

@param Model $model
@param array $data
@return bool
@throws Exception
Stores submitted form field data on a model .