mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-16 05:13:45 +02:00
update all model factories
This commit is contained in:
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
352
composer.lock
generated
352
composer.lock
generated
@@ -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": "*",
|
||||
|
||||
29
database/factories/AllocationFactory.php
Normal file
29
database/factories/AllocationFactory.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Pterodactyl\Models\Allocation;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class AllocationFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Allocation::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'ip' => $this->faker->ipv4,
|
||||
'port' => $this->faker->randomNumber(5),
|
||||
];
|
||||
}
|
||||
}
|
||||
37
database/factories/ApiKeyFactory.php
Normal file
37
database/factories/ApiKeyFactory.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Pterodactyl\Models\ApiKey;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class ApiKeyFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = ApiKey::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
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(),
|
||||
'updated_at' => Carbon::now(),
|
||||
];
|
||||
}
|
||||
}
|
||||
37
database/factories/DatabaseFactory.php
Normal file
37
database/factories/DatabaseFactory.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
use Pterodactyl\Models\Database;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class DatabaseFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Database::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
static $password;
|
||||
|
||||
return [
|
||||
'database' => Str::random(10),
|
||||
'username' => Str::random(10),
|
||||
'remote' => '%',
|
||||
'password' => $password ?: bcrypt('test123'),
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
];
|
||||
}
|
||||
}
|
||||
32
database/factories/DatabaseHostFactory.php
Normal file
32
database/factories/DatabaseHostFactory.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Pterodactyl\Models\DatabaseHost;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class DatabaseHostFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = DatabaseHost::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->colorName,
|
||||
'host' => $this->faker->unique()->ipv4,
|
||||
'port' => 3306,
|
||||
'username' => $this->faker->colorName,
|
||||
'password' => Crypt::encrypt($this->faker->word),
|
||||
];
|
||||
}
|
||||
}
|
||||
31
database/factories/EggFactory.php
Normal file
31
database/factories/EggFactory.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Pterodactyl\Models\Egg;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class EggFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Egg::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'uuid' => $this->faker->unique()->uuid,
|
||||
'name' => $this->faker->name,
|
||||
'description' => implode(' ', $this->faker->sentences()),
|
||||
'startup' => 'java -jar test.jar',
|
||||
];
|
||||
}
|
||||
}
|
||||
62
database/factories/EggVariableFactory.php
Normal file
62
database/factories/EggVariableFactory.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Pterodactyl\Models\EggVariable;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class EggVariableFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = EggVariable::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $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,
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,199 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Cake\Chronos\Chronos;
|
||||
use Illuminate\Support\Str;
|
||||
use Pterodactyl\Models\Node;
|
||||
use Faker\Generator as Faker;
|
||||
use Pterodactyl\Models\ApiKey;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of your model factories. Model factories give
|
||||
| you a convenient way to create models for testing and seeding your
|
||||
| database. Just tell the factory how a default model should look.
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->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(),
|
||||
];
|
||||
});
|
||||
31
database/factories/NestFactory.php
Normal file
31
database/factories/NestFactory.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Pterodactyl\Models\Nest;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class NestFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Nest::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'uuid' => $this->faker->unique()->uuid,
|
||||
'author' => 'testauthor@example.com',
|
||||
'name' => $this->faker->word,
|
||||
'description' => null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
28
database/factories/ScheduleFactory.php
Normal file
28
database/factories/ScheduleFactory.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Pterodactyl\Models\Schedule;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class ScheduleFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Schedule::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->firstName(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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()),
|
||||
|
||||
26
database/factories/SubuserFactory.php
Normal file
26
database/factories/SubuserFactory.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Pterodactyl\Models\Subuser;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class SubuserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Subuser::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
32
database/factories/TaskFactory.php
Normal file
32
database/factories/TaskFactory.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Pterodactyl\Models\Task;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class TaskFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Task::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'sequence_id' => $this->faker->randomNumber(1),
|
||||
'action' => 'command',
|
||||
'payload' => 'test command',
|
||||
'time_offset' => 120,
|
||||
'is_queued' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user