Code Duplication    Length = 11-12 lines in 2 locations

src/Form.php 2 locations

@@ 322-332 (lines=11) @@
319
            return $response;
320
        }
321
322
        DB::transaction(function () {
323
            $inserts = $this->prepareInsert($this->updates);
324
325
            foreach ($inserts as $column => $value) {
326
                $this->model->setAttribute($column, $value);
327
            }
328
329
            $this->model->save();
330
331
            $this->updateRelation($this->relations);
332
        });
333
334
        if (($response = $this->complete($this->saved)) instanceof Response) {
335
            return $response;
@@ 509-520 (lines=12) @@
506
            return $response;
507
        }
508
509
        DB::transaction(function () {
510
            $updates = $this->prepareUpdate($this->updates);
511
512
            foreach ($updates as $column => $value) {
513
                /* @var Model $this->model */
514
                $this->model->setAttribute($column, $value);
515
            }
516
517
            $this->model->save();
518
519
            $this->updateRelation($this->relations);
520
        });
521
522
        if (($result = $this->complete($this->saved)) instanceof Response) {
523
            return $result;