/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $inputs = $request->all(); $i = 0; for ($i = 1; $i <= 8; $i++) { if (isset($inputs['serial' . $i]) && isset($inputs['temperature' . $i])) { Temperature::create(['sensor_id' => $inputs['serial' . $i], 'value' => $inputs['temperature' . $i]]); } } }
/** * Run the database seeds. * * @return void */ public function run() { // this is one user Temperature::create(['sensor_id' => '28 f2 68 97 06 00 00 9b', 'value' => 0]); }