some progress
This commit is contained in:
@@ -11,15 +11,42 @@ class UptimeCheck extends Model
|
||||
|
||||
protected $fillable = [
|
||||
'site_id',
|
||||
'check_type',
|
||||
'status_code',
|
||||
'response_time_ms',
|
||||
'is_online',
|
||||
'checked_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'checked_at' => 'datetime',
|
||||
'is_online' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* Scope to filter by check type.
|
||||
*/
|
||||
public function scopeOfType($query, string $type)
|
||||
{
|
||||
return $query->where('check_type', $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope to filter HTTP checks.
|
||||
*/
|
||||
public function scopeHttpChecks($query)
|
||||
{
|
||||
return $query->where('check_type', 'http');
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope to filter ping checks.
|
||||
*/
|
||||
public function scopePingChecks($query)
|
||||
{
|
||||
return $query->where('check_type', 'ping');
|
||||
}
|
||||
|
||||
public function site(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Site::class);
|
||||
|
||||
Reference in New Issue
Block a user