Пример #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $inputs = $request->all();
     WaterLevel::create(['watervalue' => $inputs['waterlevel']]);
     Log::info($inputs);
 }
Пример #2
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'));
 }