value; $errorCode = $this->nullableTrim($errorCode); $updated = DB::update( 'insert into scheduler_runtime_status (id, last_heartbeat_at, last_result, last_error_code) ' . 'values (1, ?, ?, ?) ' . 'on duplicate key update ' . 'last_heartbeat_at = values(last_heartbeat_at), ' . 'last_result = values(last_result), ' . 'last_error_code = values(last_error_code)', $heartbeatAtUtc, $result, $errorCode ); return $updated !== false; } public function findStatus(): ?array { $row = DB::selectOne('select * from scheduler_runtime_status where id = 1 limit 1'); if (!is_array($row)) { return null; } $item = $row['scheduler_runtime_status'] ?? $row; return is_array($item) ? $item : null; } private function nullableTrim(?string $value): ?string { $value = trim((string) $value); return $value !== '' ? $value : null; } }