コード例 #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Requests\StoreCommentRequest $request)
 {
     if (Comment::create($request->all())) {
         return Redirect::back();
     } else {
         return Redirect('/');
     }
 }
コード例 #2
0
 public function store(StoreCommentRequest $request)
 {
     // TODO: findOrFail ile kontrol et. ModelNotFoundException'ı handle'a ekle.
     if (!Log::find($request->log_id)) {
         return redirect()->back();
     }
     // TODO: Bu işlemi CommentObserver'da yap.
     $request->merge(['user_id' => auth()->user()->id]);
     Comment::create($request->all());
     return redirect()->back();
 }
コード例 #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(StoreCommentRequest $request)
 {
     $comment = new Comment($request->all());
     $comment->save();
     return Comment::all();
 }
コード例 #4
0
 public function store_comment(StoreCommentRequest $request, $id)
 {
     $article = $this->article_by_path($id);
     $article->comments()->create(['username' => $request->get('username'), 'body' => $request->get('body')])->notify_admin($article);
     return redirect($request->fullUrl());
 }