src/Traits/WorksWithRelations.php
public function updateOrCreateRelations(Request $request, Model $model)
    {
        $parameterBag = $request->request;
        foreach ($parameterBag->all() as $name => $attributes) {
            if (is_array($request->{$name})) {
                $this->_checkRelationExists($model, $name);

                $relation = $model->{$name}();
                $this->handleRelations($attributes, $model, $relation);
            }
        }
    }
public function updateOrCreateRelations(Request $request, Model $model)
    {
        $parameterBag = $request->request;
        foreach ($parameterBag->all() as $name => $attributes) {
            if (is_array($request->{$name})) {
                $this->_checkRelationExists($model, $name);

                $relation = $model->{$name}();
                $this->handleRelations($attributes, $model, $relation);
            }
        }
    }
public function updateOrCreateRelations ( Request $ request , Model $ model ) { $ parameterBag = $ request -> request ; foreach ( $ parameterBag -> all ( ) as $ name => $ attributes ) { if ( is_array ( $ request -> { $ name } ) ) { $ this -> _checkRelationExists ( $ model , $ name ) ; $ relation = $ model -> { $ name } ( ) ; $ this -> handleRelations ( $ attributes , $ model , $ relation ) ; } } }
Update or create relations handling array type request data.

@param Request $request The Request object.
@param Model   $model   The eloquent model.

@return void
Update or create relations handling array type request data .