/**
  * Store a newly created resource in storage.
  *
  * @param  SurveyRequest  $request
  * @return Response
  */
 public function store(SurveyRequest $request)
 {
     // validation performed via SurveyRequest.php
     // persist the Survey to the db.
     $survey = Survey::create($request->all());
     // send email
     $this->sendEmail($survey);
     // send a flash message that Survey was added.
     flash()->success('Success', 'Survey added... Thanks!');
     // redirect back to the Survey page.
     return redirect()->back();
 }
Пример #2
0
 public function store(SurveyRequest $request)
 {
     Survey::create($request->all());
     return redirect('/');
     // TODO Make this redirect to a thank you page
 }