27 lines
562 B
PHP
27 lines
562 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Str;
|
|
|
|
/** An uptime probe: an HTTP URL or a TCP host:port whose reachability Clusev monitors. */
|
|
class HealthCheck extends Model
|
|
{
|
|
protected $guarded = [];
|
|
|
|
protected $casts = ['port' => 'integer'];
|
|
|
|
public const TYPES = ['http', 'tcp'];
|
|
|
|
protected static function booted(): void
|
|
{
|
|
static::creating(fn (self $c) => $c->uuid ??= (string) Str::uuid());
|
|
}
|
|
|
|
public function getRouteKeyName(): string
|
|
{
|
|
return 'uuid';
|
|
}
|
|
}
|