feat: 實作機台日誌核心功能與 IoT 高併發處理架構
All checks were successful
star-cloud-deploy-demo / deploy-demo (push) Successful in 36s

This commit is contained in:
2026-03-09 09:43:51 +08:00
parent 21e064ff91
commit c30c3a399d
53 changed files with 2300 additions and 2130 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Models\Machine;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Machine extends Model
{
use HasFactory;
protected $fillable = [
'name',
'location',
'status',
'temperature',
'firmware_version',
'last_heartbeat_at',
];
protected $casts = [
'last_heartbeat_at' => 'datetime',
];
public function logs()
{
return $this->hasMany(MachineLog::class);
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Models\Machine;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class MachineLog extends Model
{
use HasFactory;
const UPDATED_AT = null;
protected $fillable = [
'machine_id',
'level',
'message',
'context',
];
protected $casts = [
'context' => 'array',
];
public function machine()
{
return $this->belongsTo(Machine::class);
}
}