/** * Obtiene la información personal de un nutriologo. * * @return Response de tipo Json */ public function getInformation($id) { $nut = Nutritionist::find($id); if ($nut != null) { return response()->json(array('success' => true, 'info' => ['nut' => $nut, 'profile' => $nut->profile])); } else { return response()->json(array('success' => false, 'error' => 'Error en el servidor')); } }
/** * Creación y/o actualización de un modelo de Nutriólogo. * * @param $data Datos que serán insertados en la BD * @return Boolean */ private function saveNutritionist($data) { $success = false; $nut_data = ['grade' => $data['grade'], 'proffessional_license' => $data['proffessional_license'], 'specialization' => $data['specialization'], 'about_me' => $data['about_me']]; if (Nutritionist::updateOrCreate(['id' => \Auth::user()->id], $nut_data)) { $success = true; } return $success; }