예제 #1
0
 public function eliminarNoticia()
 {
     $response = 0;
     $id = e(Input::get('id_noticia'));
     $noticia = Noticia::buscar_noticia($id);
     if (count($noticia) != 0) {
         $response = Noticia::eliminar_noticia($id);
         if ($response == 1) {
             File::delete('img/noticia/' . $noticia->imagen_noticia);
             return Redirect::to(URL::previous())->with('mensaje', 'Noticia Eliminada Correctamente');
         } else {
             return Redirect::to(URL::previous())->with('mensaje', 'Ha ocurrido un error');
         }
     } else {
         return Redirect::to(URL::previous())->with('mensaje', 'No se ha eliminado, noticia no válida.');
     }
 }