Code Duplication    Length = 24-24 lines in 3 locations

app/Http/Controllers/RoomController.php 1 location

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

app/Http/Controllers/GuestController.php 1 location

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

app/Http/Controllers/ReservationController.php 1 location

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