misc_pterodactyl-panel/app/Http/Requests/Api/Application/Databases/DeleteDatabaseRequest.php

32 lines
767 B
PHP

<?php
namespace Pterodactyl\Http\Requests\Api\Application\Databases;
use Pterodactyl\Models\DatabaseHost;
use Pterodactyl\Services\Acl\Api\AdminAcl;
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
class DeleteDatabaseRequest extends ApplicationApiRequest
{
/**
* @var string
*/
protected $resource = AdminAcl::RESOURCE_DATABASE_HOSTS;
/**
* @var int
*/
protected $permission = AdminAcl::WRITE;
/**
* Determine if the requested database exists on the Panel.
*
* @return bool
*/
public function resourceExists(): bool
{
$databaseHost = $this->route()->parameter('databaseHost');
return $databaseHost instanceof DatabaseHost && $databaseHost->exists;
}
}