/** * this method update the data in the steps table * @param UpdateStepRequest $request the form request responsible for validating the data sent from the form * @param Step $step this is an instance from the Step model injected from the route * @return [type] redirect to the steps index page */ public function update(UpdateStepRequest $request, Step $step) { $step = $step->fill($request->all()); $step->edit_form = $request->has('edit_form') ? 1 : 0; $step->upload_files = $request->has('upload_files') ? 1 : 0; $step->save(); $this->processVerifyEmail($step); $step->children()->detach(); if (request('next_steps')) { $step->children()->attach(request('next_steps')); } return redirect()->route('registration.steps.index')->with('success', trans('registration::steps.update_success', ['name' => $step->name])); }
/** * this method update the data in the steps table * @param UpdateStepRequest $request the form request responsible for validating the data sent from the form * @param Step $step this is an instance from the Step model injected from the route * @return [type] redirect to the steps index page */ public function update(UpdateStepRequest $request, $id = 0) { $step = Step::findOrFail($id)->fill($request->all()); $step->edit_form = $request->has('edit_form') ? 1 : 0; $step->upload_files = $request->has('upload_files') ? 1 : 0; $step->files_processing = $request->has('files_processing') ? 1 : 0; $step->make_payment = $request->has('make_payment') ? 1 : 0; $step->files_matched = $request->has('files_matched') ? 1 : 0; $step->verify_email = $request->has('verify_email') ? 1 : 0; $step->files_done = $request->has('files_done') ? 1 : 0; $step->documents_processing = $request->has('documents_processing') ? 1 : 0; $step->documents_processed = $request->has('documents_processed') ? 1 : 0; foreach ($this->switches as $switch) { $step->{$switch} = $request->has($switch) ? 1 : 0; } $step->enroll = $request->has('enroll') ? 1 : 0; $step->save(); $this->processVerifyEmail($step); $step->children()->detach(); if (request('next_steps')) { $step->children()->attach(request('next_steps')); } return redirect()->route('registration.steps.index')->with('success', trans('registration::steps.update_success', ['name' => $step->name])); }