From c6eb6dc05498ed9eb1e1fffdaa5f52ba35a7e8d2 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Thu, 11 Apr 2024 03:11:19 -0400 Subject: [PATCH] Return all allocation ids back --- app/Services/Allocations/AssignmentService.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Services/Allocations/AssignmentService.php b/app/Services/Allocations/AssignmentService.php index 0b6b4c01a..22db2e33f 100644 --- a/app/Services/Allocations/AssignmentService.php +++ b/app/Services/Allocations/AssignmentService.php @@ -37,7 +37,7 @@ class AssignmentService * @throws \App\Exceptions\Service\Allocation\PortOutOfRangeException * @throws \App\Exceptions\Service\Allocation\TooManyPortsInRangeException */ - public function handle(Node $node, array $data): void + public function handle(Node $node, array $data): array { $explode = explode('/', $data['allocation_ip']); if (count($explode) !== 1) { @@ -58,6 +58,8 @@ class AssignmentService } $this->connection->beginTransaction(); + + $ids = []; foreach ($parsed as $ip) { foreach ($data['allocation_ports'] as $port) { if (!is_digit($port) && !preg_match(self::PORT_RANGE_REGEX, $port)) { @@ -99,10 +101,12 @@ class AssignmentService ]; } - Allocation::query()->insertOrIgnore($insertData); + $ids = Allocation::query()->insertOrIgnore($insertData); } } $this->connection->commit(); + + return $ids; } }