protected function insertProjectManual(Request $request, $id) { $array = Input::all(); $validator = Validator::make($array, ['content' => 'required']); if ($validator->fails()) { return Response::json('', 400); } else { $manual = ProjectManual::where('Project_FK', '=', $id)->first(); if (!empty($manual)) { $manual->content = $request->input('content'); $manual->save(); } else { $manual = new ProjectManual(); $manual->Project_FK = $id; $manual->content = $request->input('content'); $manual->save(); } } }
protected function getFinalizationPercent($id) { $counter = 0; $protocol = AcceptanceProtocol::where('Project_FK', '=', $id)->first(); if (count($protocol) > 0) { $counter++; } $manual = ProjectManual::where('Project_FK', '=', $id)->first(); if (count($manual) > 0) { $counter++; } return $counter; }