protected function getPreliminaryStudyPercent($id) { $counter = 0; $description = ProjectDescription::where('Project_FK', '=', $id)->first(); if (count($description) > 0) { $counter++; } $risk = Risk::where('Project_FK', '=', $id)->first(); if (count($risk) > 0) { $counter++; } $effort = EffortEstimation::where('Project_FK', '=', $id)->first(); if (count($effort) > 0) { $counter++; } return $counter; }
protected function insertEffortEstimation(Request $request, $id) { $effort = EffortEstimation::where('Project_FK', '=', $id)->first(); if (!empty($effort)) { $effort->content = json_encode($request->input('content')); $effort->save(); } else { $effort = new EffortEstimation(); $effort->Project_FK = $id; $effort->content = json_encode($request->input('content')); $effort->save(); } }