Example #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Question::destroy($id);
     \Session::flash('success', 'Question is successfully deleted.');
     return redirect('questions');
 }
Example #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Question::destroy($id);
     return response()->json(array('msg' => 'delete successfully'));
 }
 public function getDeleteQuestion($id)
 {
     $subj_id = Question::find($id)->subject->id;
     Question::destroy($id);
     session()->flash('flash_mess', 'Question #' . $id . ' was deleted');
     return redirect(action('SubjectController@getQuestions', $subj_id));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  Question $question
  * @return \Illuminate\Http\Response
  */
 public function destroy(Question $question)
 {
     // delete question image
     File::exists(public_path($question->question_image)) ? File::delete(public_path($question->image_question)) : null;
     File::exists(public_path($question->answer1_image)) ? File::delete(public_path($question->answer1_image)) : null;
     File::exists(public_path($question->answer2_image)) ? File::delete(public_path($question->answer2_image)) : null;
     File::exists(public_path($question->answer3_image)) ? File::delete(public_path($question->answer3_image)) : null;
     File::exists(public_path($question->answer4_image)) ? File::delete(public_path($question->answer4_image)) : null;
     Question::findOrFail($question->id) ? Question::destroy($question->id) : null;
     flash('Question is deleted');
     return redirect('questions');
 }