Path: blob/1.0-develop/app/Contracts/Repository/DatabaseRepositoryInterface.php
10284 views
<?php12namespace Pterodactyl\Contracts\Repository;34use Illuminate\Support\Collection;5use Illuminate\Contracts\Pagination\LengthAwarePaginator;67interface DatabaseRepositoryInterface extends RepositoryInterface8{9public const DEFAULT_CONNECTION_NAME = 'dynamic';1011/**12* Set the connection name to execute statements against.13*/14public function setConnection(string $connection): self;1516/**17* Return the connection to execute statements against.18*/19public function getConnection(): string;2021/**22* Return all the databases belonging to a server.23*/24public function getDatabasesForServer(int $server): Collection;2526/**27* Return all the databases for a given host with the server relationship loaded.28*/29public function getDatabasesForHost(int $host, int $count = 25): LengthAwarePaginator;3031/**32* Create a new database on a given connection.33*/34public function createDatabase(string $database): bool;3536/**37* Create a new database user on a given connection.38*/39public function createUser(string $username, string $remote, string $password, ?int $max_connections): bool;4041/**42* Give a specific user access to a given database.43*/44public function assignUserToDatabase(string $database, string $username, string $remote): bool;4546/**47* Flush the privileges for a given connection.48*/49public function flush(): bool;5051/**52* Drop a given database on a specific connection.53*/54public function dropDatabase(string $database): bool;5556/**57* Drop a given user on a specific connection.58*/59public function dropUser(string $username, string $remote): bool;60}616263