/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $egresos = Egresos::find($id); $egresos->delete(); return response()->json(["mensaje" => 'eliminado']); }
public function admin_modulo() { if ($this->auth->user()->role == 1) { $users = User::paginate(20); $users->setPath('/admin/administracion'); $pagos = Pagos::all(); $egresos = Egresos::all(); return view('/admin/admin_modulo', ['users' => $users, 'pagos' => $pagos, 'egresos' => $egresos]); } else { return Redirect::to('home'); } }
public function admin_modulo() { $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) { $id_site = \Session::get('id_site'); $sitios = Sites::where('id', $id_site)->get(); $sitio_plan = DB::table('sites')->where('id', $id_site)->value('plan'); $plan = Plans::where('id', $sitio_plan)->get(); $user_count = DB::table('sites_users')->where('id_site', $id_site)->count(); $pagos = Pagos::where('id_site', $id_site)->get(); $egresos = Egresos::where('id_site', $id_site)->get(); $cuotas = Cuotas::where('id_site', $id_site)->orderBy('concepto', 'ASC')->get(); return view('/admin/admin_modulo', ['pagos' => $pagos, 'egresos' => $egresos, 'cuotas' => $cuotas, 'sitios' => $sitios, 'plan' => $plan, 'id_site' => $id_site, 'user_count' => $user_count, 'sites' => $sites]); } else { return Redirect::to('home'); } }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $egresos = Egresos::find($id); $file = 'file/' . $egresos->path; $egresos->delete(); if (File::exists($file)) { unlink($file); } return response()->json(["mensaje" => 'eliminado']); }