/** * 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); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $networks = array_add(Network::where('user_id', Auth::user()->id)->lists('name', 'id'), 0, 'Default'); $notifications = Notifications::latest()->get(); return view('traps.create')->with('networks', $networks)->with('notifications', $notifications); }