protected function insertProjectDescription(Request $request, $id) { $array = Input::all(); $validator = Validator::make($array, ['description' => 'required']); if ($validator->fails()) { return Response::json('', 400); } else { $projectDescription = ProjectDescription::where('Project_FK', '=', $id)->first(); if (!empty($projectDescription)) { $projectDescription->description = $request->input('description'); $projectDescription->save(); } else { $projectDescription = new ProjectDescription(); $projectDescription->Project_FK = $id; $projectDescription->description = $request->input('description'); $projectDescription->save(); } } }
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; }