Code Duplication    Length = 14-15 lines in 2 locations

src/Form.php 2 locations

@@ 258-271 (lines=14) @@
255
256
        $this->prepare($data, $this->saving);
257
258
        DB::transaction(function () {
259
            $inserts = $this->prepareInsert($this->updates);
260
261
            foreach ($inserts as $column => $value) {
262
                if (is_array($value)) {
263
                    $value = implode(',', $value);
264
                }
265
                $this->model->setAttribute($column, $value);
266
            }
267
268
            $this->model->save();
269
270
            $this->saveRelation($this->relations);
271
        });
272
273
        $this->complete($this->saved);
274
@@ 401-415 (lines=15) @@
398
399
        $this->prepare($data, $this->saving);
400
401
        DB::transaction(function () {
402
            $updates = $this->prepareUpdate($this->updates);
403
404
            foreach ($updates as $column => $value) {
405
                if (is_array($value)) {
406
                    $value = implode(',', $value);
407
                }
408
409
                $this->model->setAttribute($column, $value);
410
            }
411
412
            $this->model->save();
413
414
            $this->updateRelation($this->relations);
415
        });
416
417
        $this->complete($this->saved);
418