public function editarNot() { $token = Input::get('token'); if (isset($token)) { $data = array('t' => Input::get('t'), 'c' => Input::get('c'), 'f' => Input::get('f'), 'p' => Input::get('p'), 'r' => Input::get('r'), 'id' => Input::get('i'), 'autor' => Input::get('autor'), 'enlace' => Input::get('enlace'), 'fecha' => Input::get('fecha'), 'especial' => Input::get('especial')); $validaciones = array('t' => array('required'), 'f' => array('required', 'alpha_num'), 'id' => array('required', 'alpha_num')); $validator = Validator::make($data, $validaciones); if ($validator->fails()) { $respuesta; $mensajes = $validator->messages(); foreach ($mensajes->all() as $mensaje) { $respuesta = $mensaje; } $response = array('status' => 'ERRORV', 'message' => $respuesta); } else { /* $format = "Y-m-d H:i:s"; $timestamp = time(); $fecha = date($format, $timestamp); */ // $fecha=$data['fecha']." 00:01:00"; if ($data['especial'] == 1) { // $isAsi = AsignacionesController::consultaGetResponsablePeriodoFuente(null,$data['r'],$data['f']); /*$idConPerF=$isAsi[0]; $idAsignacion=$idConPerF['asiId']; */ $editar = Noticias::where('notId', $data['id'])->update(array('notTitulo' => $data['t'], 'notContenido' => $data['c'], 'notEnlace' => $data['enlace'], 'notAutor' => $data['autor'])); } else { $isAsi = AsignacionesController::consultaGetResponsablePeriodoFuente($data['p'], $data['r'], $data['f']); $idConPerF = $isAsi[0]; $idAsignacion = $idConPerF['asiId']; $editar = Noticias::where('notId', $data['id'])->update(array('notTitulo' => $data['t'], 'notContenido' => $data['c'], 'notAsignaciones' => $idAsignacion, 'notEnlace' => $data['enlace'], 'notAutor' => $data['autor'])); } if ($editar) { $response = array('status' => 'OK', 'message' => 'Noticia editada correctamente.'); } else { $response = array('status' => 'ERROR', 'message' => 'No se pudo editar la noticia, intente de nuevo'); } } } else { $response = array('status' => 'ERROR', 'message' => 'Vuelva a intentar en un momento'); } return Response::json($response); }