protected function insertFunctionalRequirement(Request $request, $id) { $array = Input::all(); $validator = Validator::make($array, ['name' => 'required', 'content' => 'required']); if ($validator->fails()) { return Response::json('', 400); } else { $FunctionalRequirement = new FunctionalRequirement(); $FunctionalRequirement->Project_FK = $id; $FunctionalRequirement->name = $request->input('name'); $FunctionalRequirement->content = $request->input('content'); $FunctionalRequirement->save(); return Response::json($FunctionalRequirement); } }
protected function getFunctionalSpecificationPercent($id) { $counter = 0; $functional = FunctionalRequirement::where('Project_FK', '=', $id)->first(); if (count($functional) > 0) { $counter++; } $implementation = ProjectImplementation::where('Project_FK', '=', $id)->first(); if (count($implementation) > 0) { $counter++; } return $counter; }