Skip to content

Commit

Permalink
Add createServerDatabase function
Browse files Browse the repository at this point in the history
  • Loading branch information
TLingC committed Dec 16, 2019
1 parent 5e53beb commit 9ba7def
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Actions/ManagesServers.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,18 @@ public function serverDatabase($serverId, $databaseId)
return new ServerDatabase($this->get("api/application/servers/$serverId/databases/$databaseId"), $this);
}

/**
* Create a database for a server.
*
* @param integer $serverId
* @param array $data
* @return ServerDatabase
*/
public function createServerDatabase($serverId, array $data)
{
return new ServerDatabase($this->post("api/application/servers/$serverId/databases/", $data), $this);
}

/**
* Reset the password of a server's database.
*
Expand Down
11 changes: 11 additions & 0 deletions src/Resources/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,17 @@ public function database($databaseId)
{
return $this->pterodactyl->serverDatabase($this->id, $databaseId);
}

/**
* Create a database for the server.
*
* @param array $data
* @return ServerDatabase
*/
public function createDatabase(array $data)
{
return $this->pterodactyl->createServerDatabase($this->id, $data);
}

/**
* Reset a database password of the server.
Expand Down

0 comments on commit 9ba7def

Please sign in to comment.