1. 新增 remote_commands 資料表的 remark 欄位以儲存操作備註。 2. 更新 RemoteCommand 模型,將 note 與 remark 加入可批量賦值名單。 3. 更新 MachineService 的 dispatchDispense 函式,支援接收與記錄操作備註。 4. 更新 RemoteController 的 storeCommand 邏輯,將前端輸入的備註存入 remark 並支援遠端出貨指令。 5. 優化操作紀錄搜尋邏輯,支援搜尋備註欄位。 6. 重構指令中心操作紀錄介面,桌面版新增「操作備註」欄位,並優化手機版卡片顯示。 7. 調整表格欄位寬度與標頭樣式,解決「指令類型」寬度過大的問題。
47 lines
884 B
PHP
47 lines
884 B
PHP
<?php
|
|
|
|
namespace App\Models\Machine;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class RemoteCommand extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'machine_id',
|
|
'user_id',
|
|
'command_type',
|
|
'payload',
|
|
'status',
|
|
'ttl',
|
|
'note',
|
|
'remark',
|
|
'executed_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'payload' => 'array',
|
|
'executed_at' => 'datetime',
|
|
];
|
|
|
|
public function machine()
|
|
{
|
|
return $this->belongsTo(Machine::class);
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(\App\Models\System\User::class);
|
|
}
|
|
|
|
/**
|
|
* Scope for pending commands
|
|
*/
|
|
public function scopePending($query)
|
|
{
|
|
return $query->where('status', 'pending')->orderBy('created_at', 'asc');
|
|
}
|
|
}
|