/** * 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 publicIndex() { $t = Traps::where('is_public', 1)->where('status', 1)->get(); foreach ($t as $trap) { $trap['battery'] = Battery::where('traps_id', $trap['id'])->value('level'); } return view('home.public_index')->with('traps', $t); }