public function storeComment($statusId, CommentPostRequest $request) { $comment = \App\Comment::create($request->all()); auth()->user()->statusComments()->save($comment); // $status = \App\Status::findOrFail($statusId); // $status->comments()->attach($comment->id); $comment->status()->attach($statusId); flash()->success('Comment Posted Successfuly'); return redirect()->back(); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Requests\CommentPostRequest $request) { Comment::create(array_merge($request->all(), ['user_id' => \Auth::user()->id])); return redirect()->action('DiscussionController@show', ['id' => $request->get('discussion_id')]); }