VPS and dedicated server ordering, managed panels, SSO, billing, and launcher integration — forked from hosting infrastructure with server-focused routes and dashboard. Co-authored-by: Cursor <cursoragent@cursor.com>
73 lines
1.7 KiB
PHP
73 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class ServerAgent extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public const STATUS_PENDING_REGISTRATION = 'pending_registration';
|
|
public const STATUS_ONLINE = 'online';
|
|
public const STATUS_OFFLINE = 'offline';
|
|
|
|
protected $fillable = [
|
|
'customer_hosting_order_id',
|
|
'uuid',
|
|
'status',
|
|
'hostname',
|
|
'agent_version',
|
|
'platform',
|
|
'capabilities',
|
|
'metadata',
|
|
'bootstrap_token_hash',
|
|
'access_token_hash',
|
|
'access_token_issued_at',
|
|
'registered_at',
|
|
'last_heartbeat_at',
|
|
'last_seen_ip',
|
|
];
|
|
|
|
protected $casts = [
|
|
'capabilities' => 'array',
|
|
'metadata' => 'array',
|
|
'access_token_issued_at' => 'datetime',
|
|
'registered_at' => 'datetime',
|
|
'last_heartbeat_at' => 'datetime',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'bootstrap_token_hash',
|
|
'access_token_hash',
|
|
];
|
|
|
|
public function order(): BelongsTo
|
|
{
|
|
return $this->belongsTo(CustomerHostingOrder::class, 'customer_hosting_order_id');
|
|
}
|
|
|
|
public function tasks(): HasMany
|
|
{
|
|
return $this->hasMany(ServerTask::class);
|
|
}
|
|
|
|
public function sites(): HasMany
|
|
{
|
|
return $this->hasMany(ServerSite::class);
|
|
}
|
|
|
|
public function databases(): HasMany
|
|
{
|
|
return $this->hasMany(ServerDatabase::class);
|
|
}
|
|
|
|
public function files(): HasMany
|
|
{
|
|
return $this->hasMany(ServerFile::class);
|
|
}
|
|
}
|