/** * 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]); }
/** * @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'); }
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']); }
/** * Update the specified resource in storage. * * @param App\requests\CommentRequest $request * @param int $id * @return Response */ public function update(CommentRequest $request, $id) { $id = $request->segment(2); $content = $request->input('comments' . $id); $this->comment_gestion->updateContent($content, $id); return response()->json(['id' => $id, 'content' => $content]); }
/** * 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'); }
/** * 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')); }
public function store($id, CommentRequest $request) { if ($request->input('to_user') == $id) { \Auth::user()->comment()->create(['comment' => $request->input('comment'), 'to_user' => $request->input('to_user'), 'from_name' => \Auth::user()->name]); flash()->success('Komentarz został dodany!'); return redirect('/profile/' . $request->input('to_user') . ''); } else { return 'Zastanowię się nad permamentną banicją dla oszustów!'; } }
public function storeComments(CommentRequest $request, $id) { $guide = Guide::findOrFail($id); $comment = new GuideComment(); $comment->user_id = Auth::user()->id; $comment->content = ubbReplace($request->input('content')); $comment->guide_id = $id; $comment->save(); Guide::updateCommentCount($guide); return redirect('guides/' . $id . '#comments'); }
/** * 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); } }
/** * Update comment * * @return Response */ public function postUpdate($id = null, \App\Http\Requests\CommentRequest $request) { if (!isset($id) or is_null($id)) { return redirect()->action('BookmarkController@getNewsFeed')->with('flash_message', trans('comment.not_valid')); } $comment = $this->comment->find($id); if (is_null($comment)) { return redirect()->action('BookmarkController@getNewsFeed')->with('flash_message', trans('comment.not_found')); } $this->comment->update($id, $request->only('content')); return redirect()->action('BookmarkController@getRead', array($comment->bookmark_id))->with('flash_message', trans('comment.update_success')); }
/** * 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')); }
/** * @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(); }
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'); } }
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'); }
/** * Display the specified resource. * * @param CommentRequest $request * @return Response */ public function show(CommentRequest $request) { Comment::findOrNew($request->input('id')); return response()->json(['success' => true]); }
public function store($type, $id, CommentRequest $request) { $data = ['comment' => $this->commentService->create($type, $id, $request->all())]; return view('posts/comment', $data)->render(); }
public function addComment(CommentRequest $request, Article $article) { $comment = new Comment(); $date = Carbon::now(); //$comment->setPublishedAtAttribute(); $comment->content = $request->get('content'); $comment->setPublishedAtAttribute(); $comment->article()->associate($article); $comment->user()->associate(Auth::user()); $comment->save(); if (!is_null($article)) { // dd($comment); flash()->overlay('Your Comment has been successfully added!', 'Good Job'); return redirect()->back(); } return redirect('articles')->withErrors(['Error:' => 'This article does not exit anymore!']); }
/** * 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);*/ }
/** * Store a newly created resource in storage. * * @return Response */ public function store(CommentRequest $request) { $user = \Auth::user(); DB::table('comments')->insert(['username' => $user->username, 'comment_body' => $request->input('comment_body'), 'q_id' => $request->input('q_id'), 'created_at' => date("Y-m-d h:i:sa")]); return redirect('/details/' . $request->input('q_id')); }
/** * バリデーションが正しく通ることをテストします */ public function testValidationSuccess() { $this->request['comment'] = 'testing'; $this->request['entry_id'] = 1; $this->assertNull($this->request->validate()); }
/** * اضافه کردن کامنت جدید * * @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é"); }
/** * @param CommentRequest $request * @param CommentService $comment * * @return \Illuminate\Http\RedirectResponse */ public function store(CommentRequest $request, CommentService $comment) { $params = $request->only(['name', 'comment', 'entry_id']); $comment->addComment($params); return redirect()->route('entry.show', [$params['entry_id']]); }
/** * 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'); }