/** * The owner of the course can confirm it, * TODO send an email to all participants * TODO send bill to the owner * @param $id * @return \Illuminate\Http\RedirectResponse */ public function confirm($id) { #TODO only the course owner should be allowed to do this. $course = Course::findOrFail($id); $course->confirmed = true; $course->save(); $bill = new Bill(); $bill->course()->associate($course); $bill->save(); $this->sendBill(Auth::user(), $bill); \Session::flash('flash_message', 'Der Kurs wurde erfolgreich bestätigt'); \Session::flash('flash_message_type', 'success'); return redirect()->action('CourseController@show', [$course->id]); }