Exemplo n.º 1
0
 public function index()
 {
     $controls = Control::all()->keyBy('name');
     // we will get temperatures here as well to pass them to home view
     $temps = collect(Temperature::getLatest())->keyBy('sensor_id');
     // get water level value(s) and pass to view
     $waterLevel = WaterLevel::getLatest()->first();
     $rainSensor = RainSensor::getLatest()->first();
     // pass it to the view
     return view('home', compact('controls', 'temps', 'waterLevel', 'rainSensor'));
 }