public function store(Request $request, MailRepo $mailRepo) { $survey = Survey::where('id', $request->input('id'))->with('recruit')->first(); $survey->updateOrCreate(['id' => $request->input('id')], $request->all()); $mailRepo->emailAdmin('Survey Complete', 'Survey was completed', ['Recruit Name' => $survey->recruit->first_name . ' ' . $survey->recruit->last_name]); return view('admin.surveys.thank_you'); }
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); }
public function getSurvey($id) { $survey = Survey::where('id', $id)->with('user', 'recruit')->first(); return $survey; }