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');
 }
Esempio n. 4
0
 /**
  * @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');
 }
Esempio n. 5
0
 /**
  * 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'));
 }
Esempio n. 6
0
 /**
  * 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}");
 }
Esempio n. 7
0
 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);
     }
 }
Esempio n. 9
0
 /**
  * @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();
 }
Esempio n. 10
0
 /**
  * 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');
     }
 }
Esempio n. 12
0
 /**
  * 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);*/
 }
Esempio n. 14
0
 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é");
 }
Esempio n. 17
0
 /**
  * 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');
 }