/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $token = csrf_token(); $case = $this->rjCaseService->getCaseById($id); $caseFieldData = RjCase::editCaseFieldData(); $victimFieldData = Victim::fieldData(); $offenderFieldData = Offender::fieldData(); $charges = $this->chargeService->getAllCharges()->toArray(); $facilitators = $this->userService->getAllUsersByRole('facilitator')->toArray(); $caseManagerData = $this->userService->getAllUsers()->toArray(); $caseManagerList = array(); foreach ($caseManagerData as $key => $value) { if (!empty($value['username'])) { $caseManagerList[$key]['name'] = $value['username']; $caseManagerList[$key]['value'] = $value['id']; } } $caseFieldData['user_id']['options'] = $caseManagerList; return response()->json(array('data' => $case, 'token' => $token, 'caseFieldData' => $caseFieldData, 'victimFieldData' => $victimFieldData, 'offenderFieldData' => $offenderFieldData, 'chargesData' => $charges, 'facilitatorData' => $facilitators)); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $token = csrf_token(); $offender = $this->offenderService->getOffenderById($id); $cases = $this->rjCaseService->getAllCases()->toArray(); $offenderFieldData = Offender::fieldData(); return response()->json(array('data' => $offender, 'token' => $token, 'offenderFieldData' => $offenderFieldData, 'casesData' => $cases)); }