/**
  * @param Generator $generator
  * @param GeneratedProtocol $generatedProtocol
  * @return $this
  */
 public function edit(Generator $generator, GeneratedProtocol $generatedProtocol)
 {
     $questions = $generator->firstQuestionsAviable();
     return view(self::$prefixView . 'form')->with(['form_data' => ['route' => [self::$prefixRoute . 'update', $generator, $generatedProtocol], 'method' => 'PUT'], 'generatedProtocol' => $generatedProtocol, 'questions' => $questions]);
 }
 public function update(Request $request, Generator $generator)
 {
     $generator->fill($request->all());
     $generator->save();
     return redirect()->route('generators.index');
 }
 /**
  * @param Request $request
  * @param Generator $generator
  * @return array
  */
 public function order(Request $request, Generator $generator)
 {
     $generator->reorderQuestions(json_decode($request->get('questions')));
     return ['success' => true];
 }