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(); } }