Exemplo n.º 1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $noticia = Noticia::find($id);
     $noticia->delete();
     return response()->json(["mensaje" => 'eliminado']);
 }
Exemplo n.º 2
0
 public function contenidos()
 {
     if ($this->auth->user()->role == 1) {
         $noticias = Noticia::all();
         $utiles = Utiles::all();
         $morosos = Morosos::all()->where('id', 0);
         return view('/admin/contenidos', ['morosos' => $morosos, 'utiles' => $utiles, 'noticias' => $noticias]);
     } else {
         return Redirect::to('home');
     }
 }
Exemplo n.º 3
0
 public function contenidos()
 {
     $id_site = \Session::get('id_site');
     $id_user = $this->auth->user()->id;
     $user_role = Sites_users::where('id_site', $id_site)->where('id_user', $id_user)->value('role');
     $sites = Sites_users::where('id_user', $id_user)->count();
     if ($user_role == 1) {
         $noticias = Noticia::where('id_site', $id_site)->get();
         $documentos = Documentos::where('id_site', $id_site)->get();
         $utiles = Utiles::where('id_site', $id_site)->get();
         $sitios = Sites::where('id', $id_site)->get();
         return view('/admin/contenidos', ['sitios' => $sitios, 'sites' => $sites, 'utiles' => $utiles, 'noticias' => $noticias, 'documentos' => $documentos]);
     } else {
         return Redirect::to('home');
     }
 }
Exemplo n.º 4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $noticia = Noticia::find($id);
     $file = 'file/' . $noticia->path;
     $noticia->delete();
     if (File::exists($file)) {
         unlink($file);
     }
     return response()->json(["mensaje" => 'eliminado']);
 }