Code Duplication    Length = 14-15 lines in 2 locations

src/Form.php 2 locations

@@ 293-306 (lines=14) @@
290
291
        $this->prepare($data, $this->saving);
292
293
        DB::transaction(function () {
294
            $inserts = $this->prepareInsert($this->updates);
295
296
            foreach ($inserts as $column => $value) {
297
                if (is_array($value)) {
298
                    $value = implode(',', $value);
299
                }
300
                $this->model->setAttribute($column, $value);
301
            }
302
303
            $this->model->save();
304
305
            $this->saveRelation($this->relations);
306
        });
307
308
        $this->complete($this->saved);
309
@@ 436-450 (lines=15) @@
433
434
        $this->prepare($data, $this->saving);
435
436
        DB::transaction(function () {
437
            $updates = $this->prepareUpdate($this->updates);
438
439
            foreach ($updates as $column => $value) {
440
                if (is_array($value)) {
441
                    $value = implode(',', $value);
442
                }
443
444
                $this->model->setAttribute($column, $value);
445
            }
446
447
            $this->model->save();
448
449
            $this->updateRelation($this->relations);
450
        });
451
452
        $this->complete($this->saved);
453