public function destroy() { if (!Auth::check()) { return; } $data = Answers::find(Input::get("id")); $data->delete(); return "OK"; }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request) { $id = $request->input('parentID'); $questions = Answers::find($id); $comment = new Comment(); $comment->body = $request->input('comment'); $comment->user_id = Auth::id(); $questions->comments()->save($comment); echo $comment; }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public static function destroy($id) { if (!AuthController::checkPermission()) { return redirect('/'); } // return redirect('/'); $answer = Answers::find($id); if (count($answer) < 1) { return redirect('/'); } @unlink(public_path('images/imageAnswer/' . $answer['Photo'])); $answer->delete(); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { if (!AuthController::checkPermission()) { return redirect('/'); } $answer = Answers::find($id); $answer->delete(); }