public function getSeo($id = null) { $datos = Noticias::where('seo_slug', '=', $id)->firstOrFail(); return $this->layout->content = View::make('test.seo', compact("datos")); }
public function noticias($action) { if (isset($action)) { if ($action == "create") { $data = Noticias::firstOrCreate(Input::all()); return $respuesta = array('Record' => $data, 'Result' => "OK"); } if ($action == "edit") { Noticias::where("id", Input::get("id"))->update(Input::except("id")); return $respuesta = array('Record' => Noticias::find(Input::get('id')), 'Result' => "OK"); } if ($action == "remove") { $path = Noticias::find(Input::get("id"))->media; Event::fire('eliminarArchivo', public_path() . "/images/" . $path); Noticias::where('id', Input::get("id"))->delete(); return '{"Result":"OK"}'; } if ($action == "list") { $Records = Noticias::get(); $respuesta = array('Records' => $Records, 'Result' => "OK"); return json_encode($respuesta); } } }
public function finalizarNot() { $token = Input::get('token'); if (isset($token)) { $data = array('id' => Input::get('iN')); $validaciones = array('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); */ $editar = Noticias::where('notId', $data['id'])->update(array('notFinalizar' => 1)); if ($editar) { $response = array('status' => 'OK', 'message' => 'Noticia editada correctamente.'); } else { $response = array('status' => 'ERRORBD', 'message' => 'No se pudo finalizar el ingreso, intente de nuevo'); } } } else { $response = array('status' => 'ERROR', 'message' => 'Vuelva a intentar en un momento'); } return Response::json($response); }