Change DB tables (remove temperature) (add sensors and readings Models Controllers and migrations) (and respect reallationships)
This commit is contained in:
26
app/Models/Reading.php
Normal file
26
app/Models/Reading.php
Normal 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');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user