public function store(CommentRequest $request) { $request['published_at'] = Carbon::now(); $comment = new Comment($request->all()); Auth::user()->comments()->save($comment); return redirect('posts/' . $request['post_id']); }
/** * Crea el comentario que se hizo en una sugerencia * @param $suggestionId * @param CommentRequest $request * @return Response */ public function store(CommentRequest $request, $suggestionId) { $newComment = new Comment($request->all()); Suggestion::find($suggestionId)->comments()->save($newComment); return redirect('results/' . $suggestionId); //return Redirector->refresh(['suggestionsId' => $suggestionId]); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(CommentRequest $request) { Comment::create($request->all()); // return view('prayers.show'); // return \Redirect::back()->with('message','Comment saved.'); return redirect('prayers'); }
/** * @param Post $post */ public function store(Post $post, CommentRequest $request) { $input = $request->all(); $input['post_id'] = $post->id; Comment::create($input); $post->increment('comment_count'); }
/** * Store a newly created resource in storage. * * @param App\requests\CommentRequest $request * @return Response */ public function store(CommentRequest $request) { $this->comment_gestion->store($request->all(), $request->user()->id); if ($request->user()->valid) { return redirect()->back(); } return redirect()->back()->with('warning', trans('front/blog.warning')); }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(CommentRequest $request, $title, $slug) { $comment = new Comment($request->all()); $comment->user_id = Auth::user()->id; $comment->post_id = Post::where('slug', '=', $slug)->first()->id; Auth::user()->posts()->save($comment); return redirect("/hub/{$title}/{$slug}"); }
public function store(CommentRequest $request, Comment $comment) { $comment->fill($request->all()); $comment->user_id = Auth::user()->id; $comment->save(); $activity = 'Commented on a ' . ucfirst($request->input('belongs_to')); Activity::log($activity); return redirect()->back()->withSuccess(config('constants.SAVED')); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Requests\CommentRequest $request) { $comment = new Comment($request->all()); Auth::user()->comments()->save($comment); $flash = ['flash_message' => 'Comment has been added successfully!']; if ($request->ajax()) { return response()->json($flash + ['html' => view('comments._single', compact('comment'))->render()]); } else { return redirect()->back()->with($flash); } }
/** * @param Requests\CommentRequest $request * @param $name * @return mixed */ public function storeComment(Requests\CommentRequest $request, $name) { $data = $request->all(); $data['user_id'] = Auth::user()->id; $comment = Post::find($request->post_id)->comments()->save(Comment::create($data)); //send mail $data = array('name' => "Learning Laravel"); Mail::send('email.welcome', $data, function ($message) { $message->from('*****@*****.**', 'Learning Laravel'); $message->to('*****@*****.**')->subject('Learning Laravel test email'); }); return View("partials.comment", compact('comment'))->render(); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(CommentRequest $request) { $input = $request->all(); if (Auth::guest()) { \Session::flash('flash_message', 'You need to be logged in to comment!'); } else { $input['user_id'] = Auth::id(); Comment::create($input); } $video = Video::findOrFail($input['video_id']); $test = Video::where('id', $input['video_id'])->increment('numComments'); return view('videos/show', compact('video', 'test')); }
public function addComment(CommentRequest $request, $id) { if (\Auth::check()) { $user = \Auth::user(); $post = \App\Post::findOrFail($id); $comment = new \App\Comment($request->all()); $comment->user()->associate($user); $comment->post()->associate($post); $comment->save(); return redirect('/post/' . $post->id); } else { return redirect('/auth/login'); } }
/** * Save comment * * @return Response */ public function postCreate(\App\Http\Requests\CommentRequest $request) { $bookmark_id = $request->only('bookmark_id'); if (!isset($bookmark_id) or is_null($bookmark_id)) { return redirect()->action('BookmarkController@getNewsFeed')->with('flash_message', trans('bookmark.not_valid')); } $bookmark = $this->bookmark->find($bookmark_id); if (is_null($bookmark)) { return redirect()->action('BookmarkController@getNewsFeed') > with('flash_message', trans('bookmark.not_found')); } $id = $this->auth->user()->id; $comment = $this->comment->create($id, $request->all()); return redirect()->action('BookmarkController@getRead', array($comment->bookmark_id))->with('flash_message', trans('comment.add_success')); }
/** * insert comments to the database * with related success story * @param CommentRequest $request */ public function commentAjax(CommentRequest $request) { $input = $request->all(); Comment::create($input); //return view('errors.form_error'); /*$comments = DB::table('comments')->where('storyid',$input["storyid"])->get(); return redirect('view_story/'.$input["storyid"]) ->with('comments',$comments);*/ }
public function store($type, $id, CommentRequest $request) { $data = ['comment' => $this->commentService->create($type, $id, $request->all())]; return view('posts/comment', $data)->render(); }
/** * اضافه کردن کامنت جدید * * @param App\requests\CommentRequest $request * @return Response */ public function insert(CommentRequest $request) { $this->CommentRepository->insert($request->all()); return response()->json(); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(CommentRequest $request) { Comment::create($request->all()); return redirect(url('article/' . $request->post_id))->with('success', "Le Commentaire est bien sauvegardé"); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id, CommentRequest $request) { $comment = Comment::find($id)->update($request->all()); return redirect()->to('comment')->with('message', 'success update'); }