mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-24 21:14:45 +02:00
Return all allocation ids back
This commit is contained in:
parent
a16ef9743b
commit
c6eb6dc054
@ -37,7 +37,7 @@ class AssignmentService
|
|||||||
* @throws \App\Exceptions\Service\Allocation\PortOutOfRangeException
|
* @throws \App\Exceptions\Service\Allocation\PortOutOfRangeException
|
||||||
* @throws \App\Exceptions\Service\Allocation\TooManyPortsInRangeException
|
* @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']);
|
$explode = explode('/', $data['allocation_ip']);
|
||||||
if (count($explode) !== 1) {
|
if (count($explode) !== 1) {
|
||||||
@ -58,6 +58,8 @@ class AssignmentService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->connection->beginTransaction();
|
$this->connection->beginTransaction();
|
||||||
|
|
||||||
|
$ids = [];
|
||||||
foreach ($parsed as $ip) {
|
foreach ($parsed as $ip) {
|
||||||
foreach ($data['allocation_ports'] as $port) {
|
foreach ($data['allocation_ports'] as $port) {
|
||||||
if (!is_digit($port) && !preg_match(self::PORT_RANGE_REGEX, $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();
|
$this->connection->commit();
|
||||||
|
|
||||||
|
return $ids;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user