/** * @param Illuminate\Http\Request $request * @return Illuminate\Http\JsonResponse */ public function postIndex(Request $request) { try { $flow = new Flow(); $flow->tipo = $request->input('type'); $flow->id_revisao = $request->input('useCase'); $flow->save(); $id_fluxo = $flow->id_fluxo; $step = new Step(); $step->id_fluxo = $id_fluxo; $step->identificador = $request->input('identifier'); $step->descricao = $request->input('description'); $step->save(); $id_passos = $step->id_passos; $complementary = new Complementary(); $complementary->newSave($request->input('complementary', []), $id_passos); $business = new Business(); $business->newSave($request->input('business', []), $id_passos); $reference = new Reference(); $reference->newSave($request->input('reference', []), $id_passos); return $this->getJsonResponse($id_passos . ',' . $id_fluxo); } catch (\Exception $exception) { return $this->getJsonResponse(['data' => $exception->getMessage(), 'error' => true], false); } }
/** * @param int $id_passos * @param Request $request */ protected function updateStep($id_passos, Request $request) { $passos = $this->step->find($id_passos); $passos->identificador = $request->input('identifier'); $passos->descricao = $request->input('description'); $passos->save(); }