Stabilize discovery workflow
This commit is contained in:
@@ -52,6 +52,14 @@ class DeviceRepository
|
||||
return $row ? Device::fromArray($row) : null;
|
||||
}
|
||||
|
||||
public function findByIp(string $ipAddress): ?Device
|
||||
{
|
||||
$stmt = $this->pdo->prepare('SELECT * FROM devices WHERE primary_ip = :ip');
|
||||
$stmt->execute(['ip' => $ipAddress]);
|
||||
$row = $stmt->fetch();
|
||||
return $row ? Device::fromArray($row) : null;
|
||||
}
|
||||
|
||||
public function getCount(): int
|
||||
{
|
||||
return (int)$this->pdo->query('SELECT COUNT(*) FROM devices')->fetchColumn();
|
||||
|
||||
Reference in New Issue
Block a user