Push beginning of DB deletion stuff
This commit is contained in:
parent
c28e9c1ab7
commit
9be2aa4ca9
9 changed files with 120 additions and 16 deletions
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Requests\Api\Client\Servers\Databases;
|
||||
|
||||
use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Models\Database;
|
||||
use Pterodactyl\Contracts\Http\ClientPermissionsRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
|
||||
|
||||
class DeleteDatabaseRequest extends ClientApiRequest implements ClientPermissionsRequest
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function permission(): string
|
||||
{
|
||||
return 'delete-database';
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the provided database even belongs to this server instance.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function resourceExists(): bool
|
||||
{
|
||||
$server = $this->getModel(Server::class);
|
||||
$database = $this->getModel(Database::class);
|
||||
|
||||
return $database->server_id === $server->id;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue