public function store_survey(Request $request) { $name = $request->survey_name; $survey = new Survey(); $survey->name = $name; $survey->user_id = $this->user->id; $survey->save(); return redirect('manage/survey'); }
public function generateSurvey($user_id, $recruit_id) { $survey = new Survey(); $survey->user_id = $user_id; $survey->recruit_id = $recruit_id; $survey->save(); $this->mailSurvey($survey); return $survey; }
public function storeSurvey(Request $request) { $survey = Survey::where('created_at', '>', Carbon::today())->first(); if ($survey) { $survey->status = $request->get('status'); } else { $survey = new Survey($request->all()); } $survey->save(); return redirect(route('home'))->with('success', TRUE); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $v = \Validator::make($request->all(), ['name' => 'required|max:255']); if ($v->fails()) { return response($v->errors(), 422); } $Survey = new Survey(); $Survey->name = $request->name; $Survey->active = $request->active; $Survey->save(); return response(['ok' => true, 'data' => $Survey], 200); }
public function testShowQuestion() { $survey = new Survey(['title' => 'Testing survey']); $question = new Question(['body' => 'What is this?', 'kind' => 'voice']); $survey->save(); $question->survey()->associate($survey)->save(); $response = $this->call('GET', route('question.show', ['id' => $question->id])); $savingUrl = route('question.question_response.store', ['question_id' => $question->id], false); $absoluteSavingUrl = route('question.question_response.store', ['question_id' => $question->id]); $this->assertContains($question->body, $response->getContent()); $this->assertContains($savingUrl . '?Kind=voice', $response->getContent()); $this->assertNotContains($absoluteSavingUrl, $response->getContent()); }
/** * Store a newly created resource in storage. * * @param request $request * @return response */ public function store(Request $request) { // Create a Survey Model object $survey = new Survey(); // Set attributes from form $survey->thinking = Input::get('thinkingTxt'); $survey->crumpled = Input::get('method') == 'crumpled'; $survey->address = Input::get('address'); // Persist to DB $survey->save(); // Redirect to Summary return redirect()->action('SurveyController@summary'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(StoreSurveyRequest $request) { $survey = new Survey(); $survey->category_id = $request->get('category_id'); $survey->title = $request->get('title'); list($start_date, $end_date) = explode(' - ', $request->get('poll_date_range')); $survey->start_date = Carbon::createFromFormat('m/d/Y', $start_date)->format('Y-m-d'); $survey->end_date = Carbon::createFromFormat('m/d/Y', $end_date)->format('Y-m-d'); $survey->allowed_survey_no = $request->get('allowed_survey_no'); $survey->survey_restriction = $request->get('survey_restriction'); $survey->redirect_url = $request->get('redirect_url'); $survey->survey_status = $request->get('survey_status'); $survey->user_id = Auth::user()->id; $survey->save(); return \Redirect::route('index-survey')->with('message', 'Record has been added'); }
public function testStoreResponse() { $survey = new Survey(['title' => 'Testing survey']); $questionOne = new Question(['body' => 'What is this?', 'kind' => 'voice']); $questionTwo = new Question(['body' => 'What is that?', 'kind' => 'voice']); $survey->save(); $questionOne->survey()->associate($survey)->save(); $questionTwo->survey()->associate($survey)->save(); $responseForQuestion = ['RecordingUrl' => '//somefake.mp3', 'CallSid' => '7h1515un1qu3', 'Kind' => 'voice']; $firstResponse = $this->call('POST', route('question.question_response.store', ['question_id' => $questionOne->id]), $responseForQuestion); $routeToNextQuestion = route('question.show', ['id' => $questionTwo->id], false); $routeToNextQuestionAbsolute = route('question.show', ['id' => $questionTwo->id], true); $this->assertContains($routeToNextQuestion, $firstResponse->getContent()); $secondResponse = $this->call('POST', route('question.question_response.store', ['question_id' => $questionTwo->id]), $responseForQuestion); $this->assertNotContains('Redirect', $secondResponse->getContent()); }