All checks were successful
star-cloud-deploy-demo / deploy-demo (push) Successful in 1m2s
39 lines
726 B
PHP
39 lines
726 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',
|
|
'command_type',
|
|
'payload',
|
|
'status',
|
|
'ttl',
|
|
'executed_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'payload' => 'array',
|
|
'executed_at' => 'datetime',
|
|
];
|
|
|
|
public function machine()
|
|
{
|
|
return $this->belongsTo(Machine::class);
|
|
}
|
|
|
|
/**
|
|
* Scope for pending commands
|
|
*/
|
|
public function scopePending($query)
|
|
{
|
|
return $query->where('status', 'pending')->orderBy('created_at', 'asc');
|
|
}
|
|
}
|