예제 #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request, $orgId)
 {
     $poll = new \App\Poll();
     $poll->organization_id = $orgId;
     $poll->fill($request->input('Poll', []));
     $poll->closed_by = date("Y-m-d H:i:s", strtotime($poll->closed_by));
     if ($poll->isValid()) {
         $poll->save();
         return redirect()->route('poll.index', ['orgId' => $poll->organization_id]);
     } else {
         return redirect()->route('poll.create')->withErrors($poll->getErrors())->withInput();
     }
 }