/** * Remove the specified resource from storage. * * @param Quiz $quiz * @return \Illuminate\Http\Response */ public function destroy(Quiz $quiz) { $quiz->delete(); return redirect()->action('QuizzesController@index'); }
/** * Remove the specified resource from storage. * * @param Quiz $quiz * @return Response * @throws \Exception * @internal param int $id */ public function destroy(Quiz $quiz) { foreach ($quiz->tests as $test) { foreach ($test->results as $result) { $result->delete(); } $test->delete(); } foreach ($quiz->questions as $question) { $question->answers()->delete(); } $quiz->questions()->delete(); $quiz->delete(); return redirect()->back(); }
/** * Remove the specified resource from storage. * * @param Quiz $quiz * @return Response * @throws \Exception * @internal param int $id */ public function destroy(Quiz $quiz) { $quiz->delete(); return redirect()->back(); }