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