Exemplo n.º 1
0
 public function processStage4(Info $i, Request $request)
 {
     $info = Info::find($request->input('id'));
     $check_released = is_null($request->input('released')) ? 'no' : 'yes';
     $info->check_released = $check_released;
     $info->track_no = $request->input('track_no');
     $message = 'Record has been updated.';
     // Move to stage 0
     // Mark the last deadline to now/today to recognize 15 working days
     // Calculate difference from first to last deadline dates
     if ($check_released == 'yes' && $info->stage == 4) {
         $info->stage = 0;
         $info->claim_status = 'approved';
         $info->l_deadline = \Carbon\Carbon::now('Asia/Manila');
         $info->days_accomplished = $i->getDeadLineDifference($i, $info->f_deadline, $info->l_deadline);
         $message = "Record has been updated. Congrats! The claimant has finished the new GIBX claim process.";
     }
     if ($info->save()) {
         return redirect()->to('/encoded/desc')->with('message', $message);
     } else {
         return 'Something went wrong recording, please contact master Jim from GIBX';
     }
 }