Code Duplication    Length = 11-12 lines in 2 locations

src/Form.php 2 locations

@@ 562-573 (lines=12) @@
559
            return $response;
560
        }
561
562
        DB::transaction(function () {
563
            $updates = $this->prepareUpdate($this->updates);
564
565
            foreach ($updates as $column => $value) {
566
                /* @var Model $this->model */
567
                $this->model->setAttribute($column, $value);
568
            }
569
570
            $this->model->save();
571
572
            $this->updateRelation($this->relations);
573
        });
574
        //Disable Pjax otherwise it would cause the show() method to be called before redirecting
575
        if (request()->pjax()) {
576
            request()->headers->set('X-PJAX', false);
@@ 359-369 (lines=11) @@
356
            return $response;
357
        }
358
359
        DB::transaction(function () {
360
            $inserts = $this->prepareInsert($this->updates);
361
362
            foreach ($inserts as $column => $value) {
363
                $this->model->setAttribute($column, $value);
364
            }
365
366
            $this->model->save();
367
368
            $this->updateRelation($this->relations);
369
        });
370
371
        if (($response = $this->callSaved()) instanceof Response) {
372
            return $response;