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

32 lines
751 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
{
$database = $this->route()->parameter('database');
return $database instanceof DatabaseHost && $database->exists;
}
}