Пример #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param string $rp_id
  * @param string $header_id
  * @param string $detail_id
  *
  * @return Response
  */
 public function destroy($rp_id, $header_id, $detail_id)
 {
     if (request()->ajax()) {
         if ($this->repository->getDetailById(decode($detail_id)) && $this->repository->removeDetail()) {
             return response()->json(['location' => route('de.client.list', ['rp_id' => $rp_id, 'header_id' => $header_id])]);
         }
         return response()->json(['err' => 'Unauthorized action.'], 401);
     }
     return redirect()->back();
 }
Пример #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  QuestionFormRequest $request
  *
  * @return \Illuminate\Http\Response
  */
 public function updateDe(QuestionFormRequest $request, $rp_id, $header_id, $detail_id)
 {
     if ($this->detailRepository->getDetailById(decode($detail_id))) {
         $request['detail'] = $this->detailRepository->getModel();
         if ($this->repository->updateQuestionDe($request)) {
             return redirect()->route('de.client.list', ['rp_id' => $rp_id, 'header_id' => $header_id])->with(['success_question' => 'El Cuestionario de Salud se actualizó correctamente']);
         }
     }
     return redirect()->back()->with(['error_question' => 'El Cuestionario de Salud no pudo ser actualizado'])->withInput()->withErrors($this->repository->getErrors());
 }
Пример #3
0
 /**
  * Update the specified resource in storage.
  *
  * @param  BeneficiaryDeFormRequest $request
  *
  * @return \Illuminate\Http\Response
  */
 public function update(BeneficiaryDeFormRequest $request, $rp_id, $header_id, $detail_id)
 {
     if ($request->ajax()) {
         if ($this->detailRepository->getDetailById(decode($detail_id))) {
             $request['detail'] = $this->detailRepository->getModel();
             if ($this->repository->updateBeneficiary($request)) {
                 return response()->json(['location' => route('de.edit', compact('rp_id', 'header_id'))]);
             }
         }
         return response()->json(['err' => 'Unauthorized action.'], 401);
     }
     return redirect()->back();
 }