示例#1
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');
     }
 }
示例#2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $util = Utiles::find($id);
     $util->delete();
     return response()->json(["mensaje" => 'eliminado']);
 }
示例#3
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');
     }
 }