'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'); } }