Code Duplication    Length = 13-14 lines in 2 locations

app/Http/Controllers/ExchangeController.php 2 locations

@@ 28-40 (lines=13) @@
25
     *
26
     * @return \Illuminate\Http\Response
27
     */
28
    public function confirm($id)
29
    {
30
        $exchange = DB::transaction(function () use ($id) {
31
            $exchange = student()->proposedExchanges()->findOrFail($id);
32
33
            return $exchange->perform();
34
        });
35
36
        event(new ExchangeWasConfirmed($exchange));
37
        flash('The shift exchange request was successfully confirmed.')->success();
38
39
        return redirect()->back();
40
    }
41
42
    /**
43
     * Store a decline of an exchange in storage.
@@ 49-62 (lines=14) @@
46
     *
47
     * @return \Illuminate\Http\Response
48
     */
49
    public function decline($id)
50
    {
51
        $exchange = DB::transaction(function () use ($id) {
52
            $exchange = student()->proposedExchanges()->findOrFail($id);
53
            $exchange->delete();
54
55
            return $exchange;
56
        });
57
58
        event(new ExchangeWasDeclined($exchange));
59
        flash('The shift exchange request was successfully declined.')->success();
60
61
        return redirect()->back();
62
    }
63
}
64