diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 73d56ad7..7e847f43 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: true matrix: - php: [7.3, 7.4] + php: [7.3, 7.4, 8.0] name: PHP ${{ matrix.php }} steps: - name: checkout diff --git a/composer.json b/composer.json index cbb73e3b..cf134726 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ } ], "require": { - "php": "^7.4", + "php": "^7.3", "ext-json": "*", "ext-mbstring": "*", "ext-pdo_mysql": "*", @@ -20,6 +20,7 @@ "aws/aws-sdk-php": "^3.171", "cakephp/chronos": "^1.3", "doctrine/dbal": "^2.12", + "facade/ignition": "^2.5", "fideloper/proxy": "^4.4", "guzzlehttp/guzzle": "^7.0.1", "hashids/hashids": "^4.1", @@ -32,10 +33,11 @@ "league/flysystem-aws-s3-v3": "^1.0", "league/flysystem-memory": "^1.0", "matriphe/iso-639": "^1.2", + "nunomaduro/collision": "^5.2", "pragmarx/google2fa": "^5.0", "predis/predis": "^1.1", "prologue/alerts": "^0.4", - "psy/psysh": "^0.10.5", + "psy/psysh": "^0.10", "s1lentium/iptools": "^1.1", "spatie/laravel-fractal": "^5.8", "spatie/laravel-query-builder": "^2.8", @@ -45,9 +47,9 @@ }, "require-dev": { "barryvdh/laravel-debugbar": "^3.5", - "barryvdh/laravel-ide-helper": "^2.8", - "codedungeon/phpunit-result-printer": "^0.28.0", - "friendsofphp/php-cs-fixer": "^2.17.3", + "barryvdh/laravel-ide-helper": "^2.9", + "codedungeon/phpunit-result-printer": "^0.28", + "friendsofphp/php-cs-fixer": "^2.17", "fzaninotto/faker": "^1.9", "laravel/dusk": "^6.11", "mockery/mockery": "^1.4", diff --git a/composer.lock b/composer.lock index 3a1cb191..43f8394c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a2cef83dca88af50700a6693c94ba9c8", + "content-hash": "839be033b2b535fb0170ee9bbfe08f46", "packages": [ { "name": "appstract/laravel-blade-directives", @@ -917,6 +917,201 @@ ], "time": "2020-12-29T14:50:06+00:00" }, + { + "name": "facade/flare-client-php", + "version": "1.3.7", + "source": { + "type": "git", + "url": "https://github.com/facade/flare-client-php.git", + "reference": "fd688d3c06658f2b3b5f7bb19f051ee4ddf02492" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facade/flare-client-php/zipball/fd688d3c06658f2b3b5f7bb19f051ee4ddf02492", + "reference": "fd688d3c06658f2b3b5f7bb19f051ee4ddf02492", + "shasum": "" + }, + "require": { + "facade/ignition-contracts": "~1.0", + "illuminate/pipeline": "^5.5|^6.0|^7.0|^8.0", + "php": "^7.1|^8.0", + "symfony/http-foundation": "^3.3|^4.1|^5.0", + "symfony/mime": "^3.4|^4.0|^5.1", + "symfony/var-dumper": "^3.4|^4.0|^5.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.14", + "phpunit/phpunit": "^7.5.16", + "spatie/phpunit-snapshot-assertions": "^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Facade\\FlareClient\\": "src" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Send PHP errors to Flare", + "homepage": "https://github.com/facade/flare-client-php", + "keywords": [ + "exception", + "facade", + "flare", + "reporting" + ], + "support": { + "issues": "https://github.com/facade/flare-client-php/issues", + "source": "https://github.com/facade/flare-client-php/tree/1.3.7" + }, + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2020-10-21T16:02:39+00:00" + }, + { + "name": "facade/ignition", + "version": "2.5.8", + "source": { + "type": "git", + "url": "https://github.com/facade/ignition.git", + "reference": "8e907d81244649c5ea746e2ec30c32c5f59df472" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facade/ignition/zipball/8e907d81244649c5ea746e2ec30c32c5f59df472", + "reference": "8e907d81244649c5ea746e2ec30c32c5f59df472", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "facade/flare-client-php": "^1.3.7", + "facade/ignition-contracts": "^1.0.2", + "filp/whoops": "^2.4", + "illuminate/support": "^7.0|^8.0", + "monolog/monolog": "^2.0", + "php": "^7.2.5|^8.0", + "symfony/console": "^5.0", + "symfony/var-dumper": "^5.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.14", + "mockery/mockery": "^1.3", + "orchestra/testbench": "^5.0|^6.0", + "psalm/plugin-laravel": "^1.2" + }, + "suggest": { + "laravel/telescope": "^3.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + }, + "laravel": { + "providers": [ + "Facade\\Ignition\\IgnitionServiceProvider" + ], + "aliases": { + "Flare": "Facade\\Ignition\\Facades\\Flare" + } + } + }, + "autoload": { + "psr-4": { + "Facade\\Ignition\\": "src" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A beautiful error page for Laravel applications.", + "homepage": "https://github.com/facade/ignition", + "keywords": [ + "error", + "flare", + "laravel", + "page" + ], + "support": { + "docs": "https://flareapp.io/docs/ignition-for-laravel/introduction", + "forum": "https://twitter.com/flareappio", + "issues": "https://github.com/facade/ignition/issues", + "source": "https://github.com/facade/ignition" + }, + "time": "2020-12-29T09:12:55+00:00" + }, + { + "name": "facade/ignition-contracts", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/facade/ignition-contracts.git", + "reference": "3c921a1cdba35b68a7f0ccffc6dffc1995b18267" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facade/ignition-contracts/zipball/3c921a1cdba35b68a7f0ccffc6dffc1995b18267", + "reference": "3c921a1cdba35b68a7f0ccffc6dffc1995b18267", + "shasum": "" + }, + "require": { + "php": "^7.3|^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^v2.15.8", + "phpunit/phpunit": "^9.3.11", + "vimeo/psalm": "^3.17.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Facade\\IgnitionContracts\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://flareapp.io", + "role": "Developer" + } + ], + "description": "Solution contracts for Ignition", + "homepage": "https://github.com/facade/ignition-contracts", + "keywords": [ + "contracts", + "flare", + "ignition" + ], + "support": { + "issues": "https://github.com/facade/ignition-contracts/issues", + "source": "https://github.com/facade/ignition-contracts/tree/1.0.2" + }, + "time": "2020-10-16T08:27:54+00:00" + }, { "name": "fideloper/proxy", "version": "4.4.1", @@ -975,6 +1170,71 @@ }, "time": "2020-10-22T13:48:01+00:00" }, + { + "name": "filp/whoops", + "version": "2.9.1", + "source": { + "type": "git", + "url": "https://github.com/filp/whoops.git", + "reference": "307fb34a5ab697461ec4c9db865b20ff2fd40771" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/filp/whoops/zipball/307fb34a5ab697461ec4c9db865b20ff2fd40771", + "reference": "307fb34a5ab697461ec4c9db865b20ff2fd40771", + "shasum": "" + }, + "require": { + "php": "^5.5.9 || ^7.0 || ^8.0", + "psr/log": "^1.0.1" + }, + "require-dev": { + "mockery/mockery": "^0.9 || ^1.0", + "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.3", + "symfony/var-dumper": "^2.6 || ^3.0 || ^4.0 || ^5.0" + }, + "suggest": { + "symfony/var-dumper": "Pretty print complex values better with var-dumper available", + "whoops/soap": "Formats errors as SOAP responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Whoops\\": "src/Whoops/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Filipe Dobreira", + "homepage": "https://github.com/filp", + "role": "Developer" + } + ], + "description": "php error handling for cool kids", + "homepage": "https://filp.github.io/whoops/", + "keywords": [ + "error", + "exception", + "handling", + "library", + "throwable", + "whoops" + ], + "support": { + "issues": "https://github.com/filp/whoops/issues", + "source": "https://github.com/filp/whoops/tree/2.9.1" + }, + "time": "2020-11-01T12:00:00+00:00" + }, { "name": "graham-campbell/result-type", "version": "v1.0.1", @@ -2609,6 +2869,94 @@ }, "time": "2020-12-20T10:01:03+00:00" }, + { + "name": "nunomaduro/collision", + "version": "v5.2.0", + "source": { + "type": "git", + "url": "https://github.com/nunomaduro/collision.git", + "reference": "aca954fd03414ba0dd85d7d8e42ba9b251893d1f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nunomaduro/collision/zipball/aca954fd03414ba0dd85d7d8e42ba9b251893d1f", + "reference": "aca954fd03414ba0dd85d7d8e42ba9b251893d1f", + "shasum": "" + }, + "require": { + "facade/ignition-contracts": "^1.0", + "filp/whoops": "^2.7.2", + "php": "^7.3 || ^8.0", + "symfony/console": "^5.0" + }, + "require-dev": { + "brianium/paratest": "^6.1", + "fideloper/proxy": "^4.4.1", + "friendsofphp/php-cs-fixer": "^2.17.3", + "fruitcake/laravel-cors": "^2.0.3", + "laravel/framework": "^9.0", + "nunomaduro/larastan": "^0.6.2", + "nunomaduro/mock-final-classes": "^1.0", + "orchestra/testbench": "^7.0", + "phpstan/phpstan": "^0.12.64", + "phpunit/phpunit": "^9.5.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "NunoMaduro\\Collision\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "Cli error handling for console/command-line PHP applications.", + "keywords": [ + "artisan", + "cli", + "command-line", + "console", + "error", + "handling", + "laravel", + "laravel-zero", + "php", + "symfony" + ], + "support": { + "issues": "https://github.com/nunomaduro/collision/issues", + "source": "https://github.com/nunomaduro/collision" + }, + "funding": [ + { + "url": "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + }, + { + "url": "https://www.patreon.com/nunomaduro", + "type": "patreon" + } + ], + "time": "2021-01-13T10:00:08+00:00" + }, { "name": "opis/closure", "version": "3.6.1", @@ -10729,7 +11077,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^7.4", + "php": "^7.3", "ext-json": "*", "ext-mbstring": "*", "ext-pdo_mysql": "*", diff --git a/database/factories/AllocationFactory.php b/database/factories/AllocationFactory.php new file mode 100644 index 00000000..448cf43f --- /dev/null +++ b/database/factories/AllocationFactory.php @@ -0,0 +1,29 @@ + $this->faker->ipv4, + 'port' => $this->faker->randomNumber(5), + ]; + } +} diff --git a/database/factories/ApiKeyFactory.php b/database/factories/ApiKeyFactory.php new file mode 100644 index 00000000..eb1a10f5 --- /dev/null +++ b/database/factories/ApiKeyFactory.php @@ -0,0 +1,37 @@ + ApiKey::TYPE_APPLICATION, + 'identifier' => str_random(\Pterodactyl\Models\ApiKey::IDENTIFIER_LENGTH), + 'token' => $token ?: $token = encrypt(str_random(\Pterodactyl\Models\ApiKey::KEY_LENGTH)), + 'allowed_ips' => null, + 'memo' => 'Test Function Key', + 'created_at' => Carbon::now(), + 'updated_at' => Carbon::now(), + ]; + } +} diff --git a/database/factories/DatabaseFactory.php b/database/factories/DatabaseFactory.php new file mode 100644 index 00000000..01933a92 --- /dev/null +++ b/database/factories/DatabaseFactory.php @@ -0,0 +1,37 @@ + Str::random(10), + 'username' => Str::random(10), + 'remote' => '%', + 'password' => $password ?: bcrypt('test123'), + 'created_at' => Carbon::now(), + 'updated_at' => Carbon::now(), + ]; + } +} diff --git a/database/factories/DatabaseHostFactory.php b/database/factories/DatabaseHostFactory.php new file mode 100644 index 00000000..2862b14c --- /dev/null +++ b/database/factories/DatabaseHostFactory.php @@ -0,0 +1,32 @@ + $this->faker->colorName, + 'host' => $this->faker->unique()->ipv4, + 'port' => 3306, + 'username' => $this->faker->colorName, + 'password' => Crypt::encrypt($this->faker->word), + ]; + } +} diff --git a/database/factories/EggFactory.php b/database/factories/EggFactory.php new file mode 100644 index 00000000..21ebda20 --- /dev/null +++ b/database/factories/EggFactory.php @@ -0,0 +1,31 @@ + $this->faker->unique()->uuid, + 'name' => $this->faker->name, + 'description' => implode(' ', $this->faker->sentences()), + 'startup' => 'java -jar test.jar', + ]; + } +} diff --git a/database/factories/EggVariableFactory.php b/database/factories/EggVariableFactory.php new file mode 100644 index 00000000..5533056c --- /dev/null +++ b/database/factories/EggVariableFactory.php @@ -0,0 +1,62 @@ + $this->faker->firstName, + 'description' => $this->faker->sentence(), + 'env_variable' => strtoupper(str_replace(' ', '_', $this->faker->words(2, true))), + 'default_value' => $this->faker->colorName, + 'user_viewable' => 0, + 'user_editable' => 0, + 'rules' => 'required|string', + ]; + } + + /** + * Indicate that the egg variable is viewable. + * + * @return \Illuminate\Database\Eloquent\Factories\Factory + */ + public function viewable(): Factory + { + return $this->state(function (array $attributes) { + return [ + 'user_viewable' => 1, + ]; + }); + } + + /** + * Indicate that the egg variable is editable. + * + * @return \Illuminate\Database\Eloquent\Factories\Factory + */ + public function editable(): Factory + { + return $this->state(function (array $attributes) { + return [ + 'user_editable' => 1, + ]; + }); + } +} diff --git a/database/factories/LocationFactory.php b/database/factories/LocationFactory.php index 47f5304d..15238be1 100644 --- a/database/factories/LocationFactory.php +++ b/database/factories/LocationFactory.php @@ -2,6 +2,7 @@ namespace Database\Factories; +use Illuminate\Support\Str; use Pterodactyl\Models\Location; use Illuminate\Database\Eloquent\Factories\Factory; @@ -21,6 +22,9 @@ class LocationFactory extends Factory */ public function definition(): array { - return []; + return [ + 'short' => Str::random(8), + 'long' => Str::random(32), + ]; } } diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php deleted file mode 100644 index 7ce7fa83..00000000 --- a/database/factories/ModelFactory.php +++ /dev/null @@ -1,199 +0,0 @@ -define(Pterodactyl\Models\Server::class, function (Faker $faker) { - return [ - 'uuid' => Uuid::uuid4()->toString(), - 'uuidShort' => str_random(8), - 'name' => $faker->firstName, - 'description' => implode(' ', $faker->sentences()), - 'skip_scripts' => 0, - 'suspended' => 0, - 'memory' => 512, - 'swap' => 0, - 'disk' => 512, - 'io' => 500, - 'cpu' => 0, - 'oom_disabled' => 0, - 'installed' => 1, - 'database_limit' => null, - 'allocation_limit' => null, - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), - ]; -}); - -$factory->define(Pterodactyl\Models\User::class, function (Faker $faker) { - static $password; - - return [ - 'external_id' => $faker->unique()->isbn10, - 'uuid' => $faker->uuid, - 'username' => $faker->userName, - 'email' => $faker->safeEmail, - 'name_first' => $faker->firstName, - 'name_last' => $faker->lastName, - 'password' => $password ?: $password = bcrypt('password'), - 'language' => 'en', - 'root_admin' => false, - 'use_totp' => false, - 'created_at' => Chronos::now(), - 'updated_at' => Chronos::now(), - ]; -}); - -$factory->state(Pterodactyl\Models\User::class, 'admin', function () { - return [ - 'root_admin' => true, - ]; -}); - -$factory->define(Pterodactyl\Models\Location::class, function (Faker $faker) { - return [ - 'short' => Str::random(8), - 'long' => $faker->catchPhrase, - ]; -}); - -$factory->define(Pterodactyl\Models\Node::class, function (Faker $faker) { - return [ - 'uuid' => Uuid::uuid4()->toString(), - 'public' => true, - 'name' => $faker->firstName, - 'fqdn' => $faker->ipv4, - 'scheme' => 'http', - 'behind_proxy' => false, - 'memory' => 1024, - 'memory_overallocate' => 0, - 'disk' => 10240, - 'disk_overallocate' => 0, - 'upload_size' => 100, - 'daemon_token_id' => Str::random(Node::DAEMON_TOKEN_ID_LENGTH), - 'daemon_token' => encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH)), - 'daemonListen' => 8080, - 'daemonSFTP' => 2022, - 'daemonBase' => '/var/lib/pterodactyl/volumes', - ]; -}); - -$factory->define(Pterodactyl\Models\Nest::class, function (Faker $faker) { - return [ - 'uuid' => $faker->unique()->uuid, - 'author' => 'testauthor@example.com', - 'name' => $faker->word, - 'description' => null, - ]; -}); - -$factory->define(Pterodactyl\Models\Egg::class, function (Faker $faker) { - return [ - 'uuid' => $faker->unique()->uuid, - 'name' => $faker->name, - 'description' => implode(' ', $faker->sentences(3)), - 'startup' => 'java -jar test.jar', - ]; -}); - -$factory->define(Pterodactyl\Models\EggVariable::class, function (Faker $faker) { - return [ - 'name' => $faker->firstName, - 'description' => $faker->sentence(), - 'env_variable' => strtoupper(str_replace(' ', '_', $faker->words(2, true))), - 'default_value' => $faker->colorName, - 'user_viewable' => 0, - 'user_editable' => 0, - 'rules' => 'required|string', - ]; -}); - -$factory->state(Pterodactyl\Models\EggVariable::class, 'viewable', function () { - return ['user_viewable' => 1]; -}); - -$factory->state(Pterodactyl\Models\EggVariable::class, 'editable', function () { - return ['user_editable' => 1]; -}); - -$factory->define(Pterodactyl\Models\Subuser::class, function (Faker $faker) { - return []; -}); - -$factory->define(Pterodactyl\Models\Allocation::class, function (Faker $faker) { - return [ - 'ip' => $faker->ipv4, - 'port' => $faker->randomNumber(5), - ]; -}); - -$factory->define(Pterodactyl\Models\DatabaseHost::class, function (Faker $faker) { - return [ - 'name' => $faker->colorName, - 'host' => $faker->unique()->ipv4, - 'port' => 3306, - 'username' => $faker->colorName, - 'password' => Crypt::encrypt($faker->word), - ]; -}); - -$factory->define(Pterodactyl\Models\Database::class, function (Faker $faker) { - static $password; - - return [ - 'database' => str_random(10), - 'username' => str_random(10), - 'remote' => '%', - 'password' => $password ?: bcrypt('test123'), - 'created_at' => Carbon::now()->toDateTimeString(), - 'updated_at' => Carbon::now()->toDateTimeString(), - ]; -}); - -$factory->define(Pterodactyl\Models\Schedule::class, function (Faker $faker) { - return [ - 'name' => $faker->firstName(), - ]; -}); - -$factory->define(Pterodactyl\Models\Task::class, function (Faker $faker) { - return [ - 'sequence_id' => $faker->randomNumber(1), - 'action' => 'command', - 'payload' => 'test command', - 'time_offset' => 120, - 'is_queued' => false, - ]; -}); - -$factory->define(Pterodactyl\Models\ApiKey::class, function (Faker $faker) { - static $token; - - return [ - 'key_type' => ApiKey::TYPE_APPLICATION, - 'identifier' => str_random(\Pterodactyl\Models\ApiKey::IDENTIFIER_LENGTH), - 'token' => $token ?: $token = encrypt(str_random(\Pterodactyl\Models\ApiKey::KEY_LENGTH)), - 'allowed_ips' => null, - 'memo' => 'Test Function Key', - 'created_at' => Carbon::now()->toDateTimeString(), - 'updated_at' => Carbon::now()->toDateTimeString(), - ]; -}); diff --git a/database/factories/NestFactory.php b/database/factories/NestFactory.php new file mode 100644 index 00000000..76ded984 --- /dev/null +++ b/database/factories/NestFactory.php @@ -0,0 +1,31 @@ + $this->faker->unique()->uuid, + 'author' => 'testauthor@example.com', + 'name' => $this->faker->word, + 'description' => null, + ]; + } +} diff --git a/database/factories/NodeFactory.php b/database/factories/NodeFactory.php index 65204fb3..a1e0970f 100644 --- a/database/factories/NodeFactory.php +++ b/database/factories/NodeFactory.php @@ -2,6 +2,7 @@ namespace Database\Factories; +use Illuminate\Support\Str; use Pterodactyl\Models\Node; use Illuminate\Database\Eloquent\Factories\Factory; @@ -21,6 +22,23 @@ class NodeFactory extends Factory */ public function definition(): array { - return []; + return [ + 'uuid' => Uuid::uuid4()->toString(), + 'public' => true, + 'name' => $this->faker->firstName, + 'fqdn' => $this->faker->ipv4, + 'scheme' => 'http', + 'behind_proxy' => false, + 'memory' => 1024, + 'memory_overallocate' => 0, + 'disk' => 10240, + 'disk_overallocate' => 0, + 'upload_size' => 100, + 'daemon_token_id' => Str::random(Node::DAEMON_TOKEN_ID_LENGTH), + 'daemon_token' => encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH)), + 'daemonListen' => 8080, + 'daemonSFTP' => 2022, + 'daemonBase' => '/var/lib/pterodactyl/volumes', + ]; } } diff --git a/database/factories/ScheduleFactory.php b/database/factories/ScheduleFactory.php new file mode 100644 index 00000000..4cb7bac6 --- /dev/null +++ b/database/factories/ScheduleFactory.php @@ -0,0 +1,28 @@ + $this->faker->firstName(), + ]; + } +} diff --git a/database/factories/ServerFactory.php b/database/factories/ServerFactory.php index 39f353b3..23f74793 100644 --- a/database/factories/ServerFactory.php +++ b/database/factories/ServerFactory.php @@ -3,7 +3,6 @@ namespace Database\Factories; use Carbon\Carbon; -use Ramsey\Uuid\Uuid; use Pterodactyl\Models\Server; use Illuminate\Database\Eloquent\Factories\Factory; @@ -24,7 +23,7 @@ class ServerFactory extends Factory public function definition() { return [ - 'uuid' => Uuid::uuid4()->toString(), + 'uuid' => $this->faker->unique()->uuid, 'uuidShort' => str_random(8), 'name' => $this->faker->firstName, 'description' => implode(' ', $this->faker->sentences()), diff --git a/database/factories/SubuserFactory.php b/database/factories/SubuserFactory.php new file mode 100644 index 00000000..64f366f7 --- /dev/null +++ b/database/factories/SubuserFactory.php @@ -0,0 +1,26 @@ + $this->faker->randomNumber(1), + 'action' => 'command', + 'payload' => 'test command', + 'time_offset' => 120, + 'is_queued' => false, + ]; + } +} diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 7cdcb626..6bd0866c 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -2,6 +2,7 @@ namespace Database\Factories; +use Carbon\Carbon; use Pterodactyl\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; @@ -21,6 +22,35 @@ class UserFactory extends Factory */ public function definition(): array { - return []; + static $password; + + return [ + 'external_id' => $this->faker->unique()->isbn10, + 'uuid' => $this->faker->uuid, + 'username' => $this->faker->userName, + 'email' => $this->faker->safeEmail, + 'name_first' => $this->faker->firstName, + 'name_last' => $this->faker->lastName, + 'password' => $password ?: $password = bcrypt('password'), + 'language' => 'en', + 'root_admin' => false, + 'use_totp' => false, + 'created_at' => Carbon::now(), + 'updated_at' => Carbon::now(), + ]; + } + + /** + * Indicate that the user is an admin. + * + * @return \Illuminate\Database\Eloquent\Factories\Factory + */ + public function admin(): Factory + { + return $this->state(function (array $attributes) { + return [ + 'root_admin' => true, + ]; + }); } }