public function update($resource_id, $quiz_id)
 {
     $resource = Resource::find($resource_id);
     $validator = Quiz::validate(Input::all());
     if ($validator->fails()) {
         return Redirect::to('resources/' . $resource->id . '/quizzes/' . $quiz_id . '/edit')->withErrors($validator)->withInput(Input::all());
     } else {
         $quiz = $resource->quizzes()->find($quiz_id);
         $quiz->title = Input::get("title");
         $quiz->description = Input::get('description');
         $quiz->no_of_questions = Input::get('no_of_questions');
         $quiz->save();
         return Redirect::to('resources/' . $resource->id . '/quizzes')->with('success', 'you have succesfully updated the quiz');
     }
 }