function repRepre() { $token = Input::get('token'); if (isset($token)) { $data = array('id' => Input::get('i'), 'id2' => Input::get('i2'), 'id3' => Input::get('i3'), 'id4' => Input::get('i4'), 'id5' => Input::get('i5'), 'id6' => Input::get('i6')); $validaciones = array('id' => array('required')); $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 { $seleccionar = NoticiasController::consultaRepRepre($data['id'], $data['id2'], $data['id3'], $data['id4'], $data['id5'], $data['id6']); if (count($seleccionar) > 0) { $response = array('status' => 'OK', 'data' => $seleccionar, 'message' => 'Resultados obtenidos'); } else { $response = array('status' => 'ERROR', 'message' => 'No se encontraron noticias registradas.'); } } } else { $response = array('status' => 'ERROR', 'message' => 'Vuelva a intentar en un momento'); } return Response::json($response); }
public function enviaRepRepre() { /***********/ $data = array('id' => Input::get('i'), 'id2' => Input::get('i2'), 'id3' => Input::get('i3'), 'id4' => Input::get('i4'), 'id5' => Input::get('i5'), 'id6' => Input::get('i6'), 'correo' => Input::get('correo'), 'relevante' => Input::get('relevante'), 'publicacion' => Input::get('publicacion'), 'representante' => Input::get('representante'), 'hora' => Input::get('hora'), 'contenido' => Input::get('contenido')); $seleccionar = NoticiasController::consultaRepRepre($data['id'], $data['id2'], $data['id3'], $data['id4'], $data['id5'], $data['id6']); if (count($seleccionar) > 0) { $body = CorreoController::crearBody($seleccionar, "Todos los períodos", "Todos los períodos", $data['relevante'], $data['publicacion'], $data['representante'], $data['hora'], $data['contenido'], NULL); $head = ''; $titulo = 'Reporte por fuente y período'; $dataCorreo = array('body' => $body, 'head' => $head, 'titulo' => $titulo); //$toEmail = "*****@*****.**"; $toEmail = $data['correo']; Mail::send('emails.envioEquiposMail', $dataCorreo, function ($message) use($toEmail) { $message->to($toEmail); $message->subject('REPORTE POR REPRESENTANTE Y PERÍODO.'); }); $response = array('status' => 'OK', 'message' => 'Correo enviado.'); } else { $response = array('status' => 'ERROR', 'message' => 'No se pudo enviar correo.'); } return Response::json($response); }