Upgrade to Laravel 9 (#4413)

Co-authored-by: DaneEveritt <dane@daneeveritt.com>
This commit is contained in:
Matthew Penner 2022-10-14 10:59:20 -06:00 committed by GitHub
parent 95e15d2c8a
commit cbcf62086f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
573 changed files with 4387 additions and 9411 deletions

View file

@ -6,7 +6,6 @@ use Illuminate\Http\Response;
use Pterodactyl\Models\Server;
use Pterodactyl\Models\Database;
use Pterodactyl\Facades\Activity;
use Pterodactyl\Repositories\Eloquent\DatabaseRepository;
use Pterodactyl\Services\Databases\DatabasePasswordService;
use Pterodactyl\Transformers\Api\Client\DatabaseTransformer;
use Pterodactyl\Services\Databases\DatabaseManagementService;
@ -19,45 +18,19 @@ use Pterodactyl\Http\Requests\Api\Client\Servers\Databases\RotatePasswordRequest
class DatabaseController extends ClientApiController
{
/**
* @var \Pterodactyl\Services\Databases\DeployServerDatabaseService
*/
private $deployDatabaseService;
/**
* @var \Pterodactyl\Repositories\Eloquent\DatabaseRepository
*/
private $repository;
/**
* @var \Pterodactyl\Services\Databases\DatabaseManagementService
*/
private $managementService;
/**
* @var \Pterodactyl\Services\Databases\DatabasePasswordService
*/
private $passwordService;
/**
* DatabaseController constructor.
*/
public function __construct(
DatabaseManagementService $managementService,
DatabasePasswordService $passwordService,
DatabaseRepository $repository,
DeployServerDatabaseService $deployDatabaseService
private DeployServerDatabaseService $deployDatabaseService,
private DatabaseManagementService $managementService,
private DatabasePasswordService $passwordService
) {
parent::__construct();
$this->deployDatabaseService = $deployDatabaseService;
$this->repository = $repository;
$this->managementService = $managementService;
$this->passwordService = $passwordService;
}
/**
* Return all of the databases that belong to the given server.
* Return all the databases that belong to the given server.
*/
public function index(GetDatabasesRequest $request, Server $server): array
{
@ -92,11 +65,9 @@ class DatabaseController extends ClientApiController
* Rotates the password for the given server model and returns a fresh instance to
* the caller.
*
* @return array
*
* @throws \Throwable
*/
public function rotatePassword(RotatePasswordRequest $request, Server $server, Database $database)
public function rotatePassword(RotatePasswordRequest $request, Server $server, Database $database): array
{
$this->passwordService->handle($database);
$database->refresh();
@ -126,6 +97,6 @@ class DatabaseController extends ClientApiController
->property('name', $database->database)
->log();
return Response::create('', Response::HTTP_NO_CONTENT);
return new Response('', Response::HTTP_NO_CONTENT);
}
}