public function store(AnswerRequest $request)
 {
     $client = Client::create();
     //Was macht hier das ->all();
     $questionData = $request->all();
     foreach ($questionData["radio_question"] as $question => $value) {
         $answer = new Answer();
         $answer->question_id = $question;
         $answer->answer = $value;
         $answer->client_id = $client->id;
         //Unterschied zwischen ->save und ::create
         $answer->save();
     }
     //Kann man das irgendwie sauberer lösen als mit dieser foreach Schleife, damit es DRY-Kompatibel ist?
     foreach ($questionData["text_question"] as $question => $value) {
         $answer = new Answer();
         $answer->question_id = $question;
         $answer->comment = $value;
         $answer->client_id = $client->id;
         //Unterschied zwischen ->save und ::create
         $answer->save();
     }
 }
 public function updateAnswer(AnswerRequest $request, Answer $answer)
 {
     $input = $request->all();
     $application = Application::find($input['application_id']);
     if ($answer->user->id != Auth::user()->id) {
         $request->session()->flash('error', 'Only the person who created an application may answer questions for it.');
         return redirect('/login');
     }
     if ($answer->application->status != 'new') {
         $request->session()->flash('error', 'Your application has been submitted, you may no longer make changes.');
         return redirect('/applications/' . $application->id . '/review');
     }
     $answer->update($input);
     // Check if a file needs to be uploaded
     if ($answer->question->type == 'file') {
         // Save uploaded file
         $upload = Document::handleUpload($request);
         // Save new document
         Document::createDocument($application, $upload, $answer);
     }
     $request->session()->flash('success', 'Your answer has been saved.');
     return redirect('/applications/' . $answer->application->id);
 }