/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy(Request $request, $id) { $activity = ActivityComment::findOrFail($id)->activity; ActivityComment::destroy($id); if ($request->has('redirect_to')) { return redirect($request->input('redirect_to')); } }
public function storeComments(CommentRequest $request, $id) { $activity = Activity::findOrFail($id); $comment = new ActivityComment(); $comment->user_id = Auth::user()->id; $comment->content = ubbReplace($request->input('content')); $comment->activity_id = $id; $comment->save(); return redirect('/activities/' . $id . '#comments'); }