Upgrade to Laravel 9 (#4413)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
This commit is contained in:
parent
95e15d2c8a
commit
cbcf62086f
573 changed files with 4387 additions and 9411 deletions
|
@ -6,7 +6,10 @@ use Illuminate\Support\Arr;
|
|||
use Pterodactyl\Models\Egg;
|
||||
use Pterodactyl\Models\Nest;
|
||||
use Pterodactyl\Models\Server;
|
||||
use League\Fractal\Resource\Item;
|
||||
use Pterodactyl\Models\EggVariable;
|
||||
use League\Fractal\Resource\Collection;
|
||||
use League\Fractal\Resource\NullResource;
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||
|
||||
class EggTransformer extends BaseTransformer
|
||||
|
@ -34,9 +37,9 @@ class EggTransformer extends BaseTransformer
|
|||
* Transform an Egg model into a representation that can be consumed by
|
||||
* the application api.
|
||||
*
|
||||
* @return array
|
||||
* @throws \JsonException
|
||||
*/
|
||||
public function transform(Egg $model)
|
||||
public function transform(Egg $model): array
|
||||
{
|
||||
$files = json_decode($model->config_files, true, 512, JSON_THROW_ON_ERROR);
|
||||
if (empty($files)) {
|
||||
|
@ -79,11 +82,9 @@ class EggTransformer extends BaseTransformer
|
|||
/**
|
||||
* Include the Nest relationship for the given Egg in the transformation.
|
||||
*
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeNest(Egg $model)
|
||||
public function includeNest(Egg $model): Item|NullResource
|
||||
{
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_NESTS)) {
|
||||
return $this->null();
|
||||
|
@ -97,11 +98,9 @@ class EggTransformer extends BaseTransformer
|
|||
/**
|
||||
* Include the Servers relationship for the given Egg in the transformation.
|
||||
*
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeServers(Egg $model)
|
||||
public function includeServers(Egg $model): Collection|NullResource
|
||||
{
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) {
|
||||
return $this->null();
|
||||
|
@ -115,10 +114,8 @@ class EggTransformer extends BaseTransformer
|
|||
/**
|
||||
* Include more detailed information about the configuration if this Egg is
|
||||
* extending another.
|
||||
*
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
*/
|
||||
public function includeConfig(Egg $model)
|
||||
public function includeConfig(Egg $model): Item|NullResource
|
||||
{
|
||||
if (is_null($model->config_from)) {
|
||||
return $this->null();
|
||||
|
@ -139,10 +136,8 @@ class EggTransformer extends BaseTransformer
|
|||
/**
|
||||
* Include more detailed information about the script configuration if the
|
||||
* Egg is extending another.
|
||||
*
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
*/
|
||||
public function includeScript(Egg $model)
|
||||
public function includeScript(Egg $model): Item|NullResource
|
||||
{
|
||||
if (is_null($model->copy_script_from)) {
|
||||
return $this->null();
|
||||
|
@ -163,11 +158,9 @@ class EggTransformer extends BaseTransformer
|
|||
/**
|
||||
* Include the variables that are defined for this Egg.
|
||||
*
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeVariables(Egg $model)
|
||||
public function includeVariables(Egg $model): Collection|NullResource
|
||||
{
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_EGGS)) {
|
||||
return $this->null();
|
||||
|
|
Reference in a new issue