public function processStage3(Info $i, Request $request) { $info = Info::find($request->input('id')); $followup_comments = $request->input('followup_comments'); $followed_up = is_null($request->input('followed_up')) ? 'no' : 'yes'; $info->followup_comments = $followup_comments; $info->followed_up = $followed_up; $info->stage_3_status = $request->input('stage_3_status'); $info->claim_status = $request->input('stage_3_status'); $info->stage_3_date = \Carbon\Carbon::parse($request->input('stage_3_date')); $info->mico_released = \Carbon\Carbon::parse($request->input('mico_released')); $message = 'Record has been updated.'; // Move to stage 4 // Add deadline of 3 days for stage 4 if ($info->stage_3_status == 'allowed' && $info->stage == 3) { $info->stage = 4; $info->dead_line = $i->getDeadLine(3); $message = "Record has been updated. Congrats! The claimant is on <strong>stage 4</strong>."; } if ($info->save()) { return redirect()->to('/encoded/desc')->with('message', $message); } else { return 'Something went wrong recording, please contact master Jim from GIBX'; } }
public function post_new_record() { $this->validate($this->request, ['name' => 'required', 'claimant' => 'required', 'coc' => 'required', 'inception' => 'required']); $info = new Info(); $info->name = $this->request->input('name'); $info->claimant = $this->request->input('claimant'); $info->coc = $this->request->input('coc'); $info->dependent = $this->request->input('dependent'); $info->inception = \Carbon\Carbon::parse($this->request->input('inception')); $info->dm = $this->request->input('dm'); $info->policy = $this->request->input('policy'); $info->documents = $this->request->input('docs'); $info->documents_comments = $this->request->input('docs_comments'); $info->encoded = \Carbon\Carbon::now('Asia/Manila'); $info->nature_of_claim = $this->request->input('nature_of_claim'); $info->type_of_sickness = $this->request->input('type_of_sickness'); $info->hospital = $this->request->input('hospital'); $info->contact = $this->request->input('contact'); $info->area = $this->request->input('area'); $info->tag = $this->request->input('tag'); $info->insurer = $this->request->input('insurer'); $info->amount = $this->request->input('amount'); $info->claim_status = 'pending'; $info->scanned = 'no'; $info->transmitted = 'no'; $info->followed_up = 'no'; $info->check_released = 'no'; // If the documents are complete, move to stage 2 // Add deadline of 3 days for stage 2 // Mark the first deadline to now/today to recognize 15 working days if ($this->request->input('docs') == 'complete') { $info->stage = 2; $info->dead_line = $info->getDeadLine(3); $info->f_deadline = \Carbon\Carbon::now('Asia/Manila'); } else { $info->stage = 1; $info->dead_line = $info->getDeadLine(5); } if ($info->save()) { return view('new_record')->with('message', 'New item has been recorded.'); } else { return 'Something went wrong recording, please contact master Jim from GIBX'; } }