Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Http\Controllers;
- use App\weather;
- use Illuminate\Http\Request;
- class weatherController extends Controller
- {
- //mostrar en la vista todos los registros
- public function historial()
- {
- $weather = weather::all();
- $title = 'Historial';
- return view ('mostrarHistorial', compact('title', 'weather'));
- }
- //guardar en la base de datos lo que envia el sensor
- public function store(){
- $data = request()->all();
- weather::create([
- 'temperature' => $data['temperature'],
- 'humidity' => $data['humidity']
- ]);
- return redirect('/historial');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement