public function storeAPI($traps_id, $level)
 {
     $status = ['traps_id' => $traps_id, 'level' => $level];
     Battery::create($status);
 }
Ejemplo n.º 2
0
 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);
 }