Create Allocation with Application API

Create new allocation(s).

Usage

<?php
    $pterodactyl->createAllocation($nodeId, array $data);

    //For a node instance
    $node->createAllocation(array $data);
?>

Parameters

Parameter Description Rules
nodeId The id of the node
data The data to create location

data

Parameter Description Rules
ip IP address required|string
alias Alias name sometimes|nullable|string|max:255
ports Ports required|array
ports.* Port string

Returns

None

Throwing exception if failed.

Example

<?php
    $pterodactyl->createAllocation(1, [
        'ip' => '123.123.123.123',
        'alias' => 'location-1.pterodactyl.panel',
        'ports' => [
            '51000',
            '51001',
            '51002'
        ]
    ]);
?>
<?php
    $node = $pterodactyl->node(1);
    $node->createAllocation([
        'ip' => '123.123.123.123',
        'alias' => 'location-1.pterodactyl.panel',
        'ports' => [
            '51000',
            '51001',
            '51002'
        ]
    ]);
?>