<?php

// app/Http/Controllers/SensorDataController.php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\SensorData;

class SensorDataController extends Controller
{
    public function store(Request $request)
    {
        // Validasi request
        $request->validate([
            'value' => 'required|integer',
        ]);

        // Simpan data ke database
        $data = SensorData::create([
            'value' => $request->value,
        ]);

        return response()->json(['message' => 'Data berhasil disimpan'], 200);
    }
}
