public function postSurvey(Request $request) { $this->validate($request, ['email' => 'required|email']); $survey = Survey::firstOrNew(['email' => $request->input('email')]); if (!$survey->exists) { $survey->current_step = 1; $survey->save(); } $request->session()->put('survey_id', $survey->id); return redirect()->action('SurveyController@getSurveyStep', ['step' => $survey->current_step]); }