| @@ 34-45 (lines=12) @@ | ||
| 31 | * |
|
| 32 | * @return \Illuminate\Http\RedirectResponse |
|
| 33 | */ |
|
| 34 | public function confirm($id) |
|
| 35 | { |
|
| 36 | $exchange = DB::transaction(function () use ($id) { |
|
| 37 | $exchange = Auth::student()->proposedExchanges()->findOrFail($id); |
|
| 38 | ||
| 39 | return $exchange->perform(); |
|
| 40 | }); |
|
| 41 | flash('The shift exchange request was successfully confirmed.')->success(); |
|
| 42 | event(new ExchangeWasConfirmed($exchange)); |
|
| 43 | ||
| 44 | return redirect()->back(); |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * Show the form for creating a new resource. |
|
| @@ 104-117 (lines=14) @@ | ||
| 101 | * |
|
| 102 | * @return \Illuminate\Http\RedirectResponse |
|
| 103 | */ |
|
| 104 | public function decline($id) |
|
| 105 | { |
|
| 106 | $exchange = DB::transaction(function () use ($id) { |
|
| 107 | $exchange = Auth::student()->proposedExchanges()->findOrFail($id); |
|
| 108 | $exchange->delete(); |
|
| 109 | ||
| 110 | return $exchange; |
|
| 111 | }); |
|
| 112 | flash('The shift exchange request was successfully declined.')->success(); |
|
| 113 | event(new ExchangeWasDeclined($exchange)); |
|
| 114 | ||
| 115 | return redirect()->back(); |
|
| 116 | } |
|
| 117 | ||
| 118 | /** |
|
| 119 | * Remove the specified resource from storage. |
|
| 120 | * |
|