Change DB tables (remove temperature) (add sensors and readings Models Controllers and migrations) (and respect reallationships)

This commit is contained in:
2020-09-13 18:39:38 +01:00
parent 919e9422ef
commit ada0ae9805
7 changed files with 101 additions and 12 deletions

26
app/Models/Reading.php Normal file
View File

@@ -0,0 +1,26 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Reading extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'type',
'value',
];
public function sensor()
{
return $this->belongsTo('App\Models\Sensor');
}
}