store() public method

Store a new comment.
public store ( $input )
$input
Ejemplo n.º 1
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'));
 }
 /**
  * Store a newly created comment in storage.
  *
  * @param Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $inputs = $request->all();
     $validator = Validator::make($inputs, ['post_id' => 'required|numeric', 'slug' => 'required|max:100|exists:posts,slug,id,' . $inputs['post_id'], 'parent' => 'required|numeric', 'name' => 'required|max:30', 'email' => 'required|email|max:100', 'blog' => 'required|url|max:100', 'origin' => 'required', 'captcha' => 'required|min:4|max:4']);
     if ($validator->fails() || $inputs['captcha'] !== session('captcha')) {
         return redirect('/posts/' . $inputs['slug'] . '#comment-form')->withErrors($validator)->withInput($inputs);
     }
     $this->comment->store($inputs);
     return redirect('/posts/' . $inputs['slug'] . '#comments')->with('ok', 'comment successfully.');
 }
Ejemplo n.º 3
0
 public function postCreate(CreateRequest $request)
 {
     $this->commentRepository->store($request->all());
     return responseSuccess('评论成功');
 }