コード例 #1
0
 /**
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(QuestionFormRequest $request)
 {
     //question, answerType, event_id
     $input['event_id'] = $request->input('event');
     $input['question'] = $request->input('question');
     $input['answerType'] = $request->input('answerType');
     $input['listItems'] = $request->input('listItems');
     // put the formatted dropdownlist into $input['listItems']
     Question::create($input);
     //Flash a message to the user
     \Flash::success('Question added successfully');
     //Redirect back to the admin page
     //return redirect(action('EventsController@admin', $request->input('event')));
     return Redirect::back()->with(['tabName' => 'questions']);
 }
コード例 #2
0
 public function store(QuestionFormRequest $request)
 {
     //return $request->all();
     $slug = uniqid();
     $question = new Question(array('question' => $request->get('question'), 'option1' => $request->get('option1'), 'option2' => $request->get('option2'), 'option3' => $request->get('option3'), 'option4' => $request->get('option4'), 'slug' => $slug));
     $question->save();
     return redirect('create')->with('status', 'Your question has been saved! Its unique id is: ' . $slug);
 }