Esempio n. 1
0
 public function submit_survey()
 {
     $input = Request::all();
     $gender = $input['gender'];
     $satisfaction = $input['satisfaction'];
     $country = $input['country'];
     $state = $input['state'];
     $city = $input['city'];
     $now = date("Y-m-d h:i:s");
     Survey::create(['Gender' => $gender, 'Satisfaction' => $satisfaction, 'Country' => $country, 'State' => $state, 'City' => $city, 'Created' => $now]);
     return redirect('/home');
 }
 /**
  * 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();
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $questions = $request->input('question');
     $options = $request->input('option');
     $survey = $request->input('active') ? Survey::create(['name' => $request->input('name'), 'active' => $request->input('active'), 'total' => count($questions)]) : Survey::create(['name' => $request->input('name'), 'total' => count($questions)]);
     for ($i = 1; $i <= count($questions); $i++) {
         $question = $survey->questions()->create(['question' => $questions[$i]]);
         for ($j = 1; $j <= count($options[$i]); $j++) {
             $question->answers()->create(['answer' => $options[$i][$j]]);
         }
     }
     return redirect()->action('SurveyController@index');
 }
Esempio n. 4
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, $this->validationRules());
     $survey = Survey::create($request->only(['name', 'description']));
     return redirect()->route('admin.surveys.edit', ['id' => $survey->id])->with('success', 'Survey created!');
 }
Esempio n. 5
0
 public function store(SurveyRequest $request)
 {
     Survey::create($request->all());
     return redirect('/');
     // TODO Make this redirect to a thank you page
 }