public function addQualificationDetails() { $client = (object) Input::all(); $db = BasicQualifications::where('user_id', '=', $client->user_id)->first(); $appData = ApplicationData::find(Input::all()['user_id']); $form_comp_data = FormCompleteData::find(Input::all()['user_id']); if (!is_null($db)) { foreach ($client as $key => $value) { if (is_array($value)) { $db->{$key} = $value['name']; } else { $db->{$key} = $value; } } $db->save(); return Response::json($db, 200); } else { $db = new BasicQualifications(); foreach ($client as $key => $value) { if (is_array($value)) { $db->{$key} = $value['name']; } else { $db->{$key} = $value; } } $db->save(); $appData->app_progress = 20 + $appData->app_progress; $appData->save(); $form_comp_data->basic_qualification_completed = "1"; $form_comp_data->save(); return Response::json($db, 200); } }