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

@ -3,7 +3,9 @@
namespace Pterodactyl\Transformers\Api\Application;
use Pterodactyl\Models\Database;
use League\Fractal\Resource\Item;
use Pterodactyl\Models\DatabaseHost;
use League\Fractal\Resource\NullResource;
use Pterodactyl\Services\Acl\Api\AdminAcl;
use Illuminate\Contracts\Encryption\Encrypter;
@ -11,10 +13,7 @@ class ServerDatabaseTransformer extends BaseTransformer
{
protected array $availableIncludes = ['password', 'host'];
/**
* @var Encrypter
*/
private $encrypter;
private Encrypter $encrypter;
/**
* Perform dependency injection.
@ -45,17 +44,15 @@ class ServerDatabaseTransformer extends BaseTransformer
'username' => $model->username,
'remote' => $model->remote,
'max_connections' => $model->max_connections,
'created_at' => $model->created_at->toIso8601String(),
'updated_at' => $model->updated_at->toIso8601String(),
'created_at' => $model->created_at->toAtomString(),
'updated_at' => $model->updated_at->toAtomString(),
];
}
/**
* Include the database password in the request.
*
* @return \League\Fractal\Resource\Item
*/
public function includePassword(Database $model)
public function includePassword(Database $model): Item
{
return $this->item($model, function (Database $model) {
return [
@ -67,11 +64,9 @@ class ServerDatabaseTransformer extends BaseTransformer
/**
* Return the database host relationship for this server database.
*
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
*
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
*/
public function includeHost(Database $model)
public function includeHost(Database $model): Item|NullResource
{
if (!$this->authorize(AdminAcl::RESOURCE_DATABASE_HOSTS)) {
return $this->null();