Code Duplication    Length = 24-24 lines in 3 locations

app/Http/Controllers/GuestController.php 1 location

@@ 41-64 (lines=24) @@
38
        return view('list', $viewData);
39
    }
40
41
    public function store(GuestRequest $request, $id = null)
42
    {
43
        if ($id === null) {
44
            $object = new Guest();
45
        } else {
46
            try {
47
                $object = Guest::findOrFail($id);
48
            } catch (ModelNotFoundException $e) {
49
                return Controller::returnBack([
50
                    'message'     => trans('general.object_not_found'),
51
                    'alert-class' => 'alert-danger',
52
                ]);
53
            }
54
        }
55
56
        $object->fill($request->all());
57
        $object->save();
58
59
        return redirect()->route($this->getRouteName().'.index')
60
            ->with([
61
                'message'     => trans('general.saved'),
62
                'alert-class' => 'alert-success',
63
            ]);
64
    }
65
66
    public function delete($id)
67
    {

app/Http/Controllers/ReservationController.php 1 location

@@ 45-68 (lines=24) @@
42
    }
43
44
    // TODO
45
    public function store(GuestRequest $request, $id = null)
46
    {
47
        if ($id === null) {
48
            $object = new Reservation();
49
        } else {
50
            try {
51
                $object = Reservation::findOrFail($id);
52
            } catch (ModelNotFoundException $e) {
53
                return Controller::returnBack([
54
                    'message'     => trans('general.object_not_found'),
55
                    'alert-class' => 'alert-danger',
56
                ]);
57
            }
58
        }
59
60
        $object->fill($request->all());
61
        $object->save();
62
63
        return redirect()->route($this->getRouteName().'.index')
64
            ->with([
65
                'message'     => trans('general.saved'),
66
                'alert-class' => 'alert-success',
67
            ]);
68
    }
69
70
    public function delete($id)
71
    {

app/Http/Controllers/RoomController.php 1 location

@@ 40-63 (lines=24) @@
37
        return view('list', $viewData);
38
    }
39
40
    public function store(RoomRequest $request, $id = null)
41
    {
42
        if ($id === null) {
43
            $object = new Room();
44
        } else {
45
            try {
46
                $object = Room::findOrFail($id);
47
            } catch (ModelNotFoundException $e) {
48
                return Controller::returnBack([
49
                    'message'     => trans('general.object_not_found'),
50
                    'alert-class' => 'alert-danger',
51
                ]);
52
            }
53
        }
54
55
        $object->fill($request->all());
56
        $object->save();
57
58
        return redirect()->route($this->getRouteName().'.index')
59
            ->with([
60
                'message'     => trans('general.saved'),
61
                'alert-class' => 'alert-success',
62
            ]);
63
    }
64
65
    public function delete($id)
66
    {