IMEI device API: telemetry, commands, receipts + migrations and routing
This commit is contained in:
21
app/Models/Command.php
Normal file
21
app/Models/Command.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Command extends Model
|
||||
{
|
||||
protected $table = 'command_queue';
|
||||
|
||||
protected $fillable = [
|
||||
'device_id','command_type','payload','priority','status',
|
||||
'not_before_at','expires_at','created_by_user_id',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'payload' => 'array',
|
||||
'not_before_at' => 'datetime',
|
||||
'expires_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
17
app/Models/CommandReceipt.php
Normal file
17
app/Models/CommandReceipt.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CommandReceipt extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'command_id','device_id','acked_at','executed_at','result','result_detail',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'acked_at' => 'datetime',
|
||||
'executed_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
18
app/Models/Device.php
Normal file
18
app/Models/Device.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Device extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'user_id','name','imei','is_active','last_seen_at','last_ip',
|
||||
'firmware_version','hardware_version',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_active' => 'boolean',
|
||||
'last_seen_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user