*/ use HasFactory; /** * The attributes that are mass assignable. * * @var list */ protected $fillable = [ 'monitor_id', 'node_id', 'round_id', 'is_up', 'response_time_ms', 'status_code', 'error_message', ]; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'is_up' => 'boolean', 'response_time_ms' => 'integer', 'status_code' => 'integer', ]; } /** * Get the monitor that owns this check result */ public function monitor(): BelongsTo { return $this->belongsTo(Monitor::class); } /** * Check if this result indicates the monitor is up */ public function isUp(): bool { return $this->is_up; } /** * Check if this result indicates the monitor is down */ public function isDown(): bool { return ! $this->is_up; } }