public function imagen($id)
 {
     $noticia = Noticia::findOrFail($id);
     $mimetype = array('gif' => 'image/gif', 'png' => 'image/png', 'jpg' => 'image/jpeg');
     $content = NULL;
     $mime = NULL;
     $nombre = NULL;
     foreach ($mimetype as $ext => $type) {
         if (Storage::has('noticias/' . $noticia->id . "." . $ext)) {
             $content = Storage::get('noticias/' . $noticia->id . "." . $ext);
             $nombre = $noticia->id . "." . $ext;
             $mime = $type;
             break;
         }
     }
     if ($content == NULL) {
         abort(404);
     }
     return response($content)->header('Content-Type', $mime)->header('filename', $nombre);
 }
 public function postDestroy(Request $request)
 {
     //abort(500);
     $noticia = Noticia::findOrFail($request->get('id'));
     $noticia->delete();
     $message = ' La noticia ' . $noticia->titulo . ' ha sido eliminada';
     //	dd($request->all());
     if ($request->ajax()) {
         //	return($message);
         return response()->json(['message' => $message]);
     }
     \Session::flash('message', $message);
     return redirect('noticias');
     //return redirect()->route('beneficios.index');
 }
 public function getNoticiasView($id)
 {
     $noticia = Noticia::findOrFail($id);
     return view('guest.noticias.vista', compact('noticia'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $noticia = Noticia::findOrFail($id);
     $archivo = $noticia->NT_IMAGEN;
     DB::table('noticias')->where('NT_ID', '=', $id)->delete();
     \Storage::disk('noticias')->delete($archivo);
     return Redirect::to('adminpage/Boletin')->with('notice', 'Elemento Eliminado exitosamente!.');
 }
 public function registrarMail(Request $request)
 {
     $mail = new DataMails();
     $mail['mail'] = $request['email'];
     $mail->save();
     $mensaje = 'Se suscribio correctamente.';
     $noticia = Noticia::findOrFail($request['id']);
     return view('noticia.show', compact('noticia', 'mensaje'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $noticia = Noticia::findOrFail($id);
     $noticia->delete();
     session::flash('message', 'Noticia eliminado de los registros');
     return redirect()->route('admin.noticia.index');
 }