Code Duplication    Length = 14-17 lines in 4 locations

app/Http/Controllers/TravelController.php 2 locations

@@ 23-39 (lines=17) @@
20
        return view('travel.create', compact('user'));
21
    }
22
23
    public function store(TravelRequest $request, User $user)
24
    {
25
        $this->authorize('edit');
26
27
        $data = $request->all();
28
        $data['author_id'] = Auth::user()->id;
29
30
        $travel = $user->travels()->create($data);
31
32
        if ($request->hasFile('files')) {
33
            Attachment::upload($travel, $request->file('files'), $data['encrypt']);
34
        }
35
36
        Notification::container()->success('Travel successfully created');
37
38
        return redirect()->action('UserController@show', $user->id);
39
    }
40
41
    public function edit(User $user, Travel $travel)
42
    {
@@ 48-61 (lines=14) @@
45
        return view('travel.edit', compact('user', 'travel'));
46
    }
47
48
    public function update(TravelRequest $request, User $user, Travel $travel)
49
    {
50
        $this->authorize('edit_training_user', $user);
51
        $data = $request->all();
52
        $travel->update($data);
53
54
        if ($request->hasFile('files')) {
55
            Attachment::upload($travel, $request->file('files'), $data['encrypt']);
56
        }
57
58
        Notification::container()->success('Travel successfully updated');
59
60
        return redirect()->action('UserController@show', $user->id);
61
    }
62
63
    public function destroy($userID, $travelID)
64
    {

app/Http/Controllers/TrainingUserController.php 1 location

@@ 79-93 (lines=15) @@
76
        return view('traininguser.edit', compact('user', 'trainingUser', 'training', 'disabled'));
77
    }
78
79
    public function update(Request $request, User $user, $trainingUserID)
80
    {
81
        $this->authorize('edit_training_user', $user);
82
        $trainingUser = TrainingUser::findOrFail($trainingUserID);
83
        $data = $request->all();
84
        $trainingUser->update($data);
85
86
        if ($request->hasFile('files')) {
87
            Attachment::upload($trainingUser, $request->file('files'), $data['encrypt']);
88
        }
89
90
        Notification::container()->success('Training successfully updated');
91
92
        return redirect()->action('UserController@show', $user->id);
93
    }
94
95
    public function destroy($userID, $trainingUserID)
96
    {

app/Http/Controllers/TrainingController.php 1 location

@@ 126-142 (lines=17) @@
123
        return view('training.edit', compact('training', 'users', 'groups', 'training_types'));
124
    }
125
126
    public function update(Request $request, Training $training)
127
    {
128
        $this->authorize('edit');
129
130
        $data = $request->all();
131
        $training->update($data);
132
        if ($request->hasFile('files')) {
133
            Attachment::upload($training, $request->file('files'));
134
        }
135
136
        $data['training_id'] = $training->id;
137
        $this->createTrainingNotes($data);
138
139
        Notification::container()->success('Training Updated');
140
141
        return redirect()->action('TrainingController@show', $training->id);
142
    }
143
144
    /**
145
     * Remove the specified resource from storage.