コード例 #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Requests\Comment\Create  $request
  * @return Response
  */
 public function store(Requests\Comment\CreateRequest $request)
 {
     $input = $request->all();
     // dd($input);
     // @todo - this is the best way to get the current logged in user?
     $input['author_id'] = \Auth::user()->id;
     // if a user is posting on their own profile then assume that they have read the comment
     if ($input['author_id'] == $input['user_id']) {
         $input['read'] = true;
     } else {
         $input['read'] = false;
     }
     \Nexus\Comment::create($input);
     return redirect("/users/" . $input['redirect_user']);
 }