/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $networks = Network::where('user_id', Auth::user()->id)->get(); $user = Auth::user(); $traps = Traps::where('user_id', $user->id)->where('status', 1)->get(); $networks->push(['name' => 'Default', 'id' => 0]); $notifications = Notifications::latest()->get(); return view('network.index')->with('traps', $traps)->with('notifications', $notifications)->with('networks', $networks); }
public function editUser($id) { if ($id != Auth::user()->id) { return redirect(route('network.index')); } $user = User::findOrFail($id); $notifications = Notifications::latest()->get(); return view('users.user_change')->with('user', $user)->with('notifications', $notifications); }
public function editImage($id) { $image = Images::findOrFail($id); $trap = Traps::findOrFail($image->trap_id); $image->user_id = $trap->user_id; $areas = Pest_image::where('id_pest_image', $id)->get(); $notifications = Notifications::latest()->get(); return view('traps.edit_image')->with('image', $image)->with('areas', $areas)->with('notifications', $notifications); }