private function _questionAfter($question) { $survey = Survey::find($question->survey_id); $allQuestions = $survey->questions()->orderBy('id', 'asc')->get(); $position = $allQuestions->search($question); $nextQuestion = $allQuestions->get($position + 1); return $nextQuestion; }
private function _questionAfter($questionId) { $question = \App\Question::find($questionId); $survey = \App\Survey::find($question->survey_id); $allQuestions = $survey->questions()->orderBy('id', 'asc')->get(); $position = $allQuestions->search($question); $nextQuestion = $allQuestions->get($position + 1); return $this->_idIfNotNull($nextQuestion); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function showSms($id) { $surveyToTake = Survey::find($id); $voiceResponse = new Twiml(); if (is_null($surveyToTake)) { return $this->_responseWithXmlType($this->_noSuchSmsSurvey($voiceResponse)); } $surveyTitle = $surveyToTake->title; $voiceResponse->message("Hello and thank you for taking the {$surveyTitle} survey!"); $voiceResponse->redirect($this->_urlForFirstQuestion($surveyToTake, 'sms'), ['method' => 'GET']); return $this->_responseWithXmlType(response($voiceResponse)); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (!($request->survey = Survey::find($request->session()->get('survey_id')))) { return redirect()->action('SurveyController@getSurvey'); } $request->maxStep = Question::max('step'); if ($request->survey->current_step > $request->maxStep) { return redirect()->action('SurveyController@getSurveyDone'); } elseif ($request->route('step') > $request->survey->current_step) { return redirect()->action('SurveyController@getSurveyStep', ['step' => $request->survey->current_step]); } return $next($request); }
public function showResults($surveyId) { $survey = \App\Survey::find($surveyId); $responsesByCall = \App\QuestionResponse::responsesForSurveyByCall($surveyId)->get()->groupBy('call_sid')->values(); return response()->view('surveys.results', ['survey' => $survey, 'responses' => $responsesByCall]); }
public function classes(Request $request = null) { $gen = Gen::find($request->gen_id); $this->data['survey'] = Survey::find($request->survey_id); $this->data['gen'] = $gen; $this->data['gens'] = Gen::all(); return view('manage.classes_survey', $this->data); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $survey = Survey::find($id); $areas = SurveyArea::where('survey_id', $id)->get(); return view('survey.edit')->with('survey', $survey)->with('areas', $areas); }
public function show($id) { $survey = Survey::find($id); return view('admin.surveys.show', compact('survey')); }