2015-12-06 18:58:49 +00:00
|
|
|
<?php
|
|
|
|
|
2017-12-17 19:07:38 +00:00
|
|
|
use Faker\Generator as Faker;
|
|
|
|
|
2015-12-06 18:58:49 +00:00
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| 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.
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2017-12-17 19:07:38 +00:00
|
|
|
$factory->define(Pterodactyl\Models\Server::class, function (Faker $faker) {
|
2017-07-23 01:15:01 +00:00
|
|
|
return [
|
2017-08-05 22:20:07 +00:00
|
|
|
'id' => $faker->unique()->randomNumber(),
|
2017-08-26 18:31:18 +00:00
|
|
|
'node_id' => $faker->randomNumber(),
|
|
|
|
'uuid' => $faker->unique()->uuid,
|
2017-07-23 01:15:01 +00:00
|
|
|
'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,
|
2017-10-27 04:49:54 +00:00
|
|
|
'allocation_id' => $faker->randomNumber(),
|
|
|
|
'nest_id' => $faker->randomNumber(),
|
|
|
|
'egg_id' => $faker->randomNumber(),
|
2017-07-23 01:15:01 +00:00
|
|
|
'pack_id' => null,
|
|
|
|
'installed' => 1,
|
|
|
|
'created_at' => \Carbon\Carbon::now(),
|
|
|
|
'updated_at' => \Carbon\Carbon::now(),
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
2017-12-17 19:07:38 +00:00
|
|
|
$factory->define(Pterodactyl\Models\User::class, function (Faker $faker) {
|
2017-10-24 01:12:15 +00:00
|
|
|
static $password;
|
|
|
|
|
2015-12-06 18:58:49 +00:00
|
|
|
return [
|
2017-08-05 22:20:07 +00:00
|
|
|
'id' => $faker->unique()->randomNumber(),
|
2017-06-14 04:25:37 +00:00
|
|
|
'external_id' => null,
|
|
|
|
'uuid' => $faker->uuid,
|
|
|
|
'username' => $faker->userName,
|
|
|
|
'email' => $faker->safeEmail,
|
|
|
|
'name_first' => $faker->firstName,
|
|
|
|
'name_last' => $faker->lastName,
|
2017-10-24 01:12:15 +00:00
|
|
|
'password' => $password ?: $password = bcrypt('password'),
|
2017-06-14 04:25:37 +00:00
|
|
|
'language' => 'en',
|
|
|
|
'root_admin' => false,
|
|
|
|
'use_totp' => false,
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
|
|
|
$factory->state(Pterodactyl\Models\User::class, 'admin', function () {
|
|
|
|
return [
|
2017-08-05 22:20:07 +00:00
|
|
|
'root_admin' => true,
|
2015-12-06 18:58:49 +00:00
|
|
|
];
|
|
|
|
});
|
2017-06-16 04:03:22 +00:00
|
|
|
|
2017-12-17 19:07:38 +00:00
|
|
|
$factory->define(Pterodactyl\Models\Location::class, function (Faker $faker) {
|
2017-06-16 04:03:22 +00:00
|
|
|
return [
|
2017-08-05 22:20:07 +00:00
|
|
|
'id' => $faker->unique()->randomNumber(),
|
|
|
|
'short' => $faker->domainWord,
|
|
|
|
'long' => $faker->catchPhrase,
|
|
|
|
];
|
2017-06-16 04:03:22 +00:00
|
|
|
});
|
2017-06-16 05:29:19 +00:00
|
|
|
|
2017-12-17 19:07:38 +00:00
|
|
|
$factory->define(Pterodactyl\Models\Node::class, function (Faker $faker) {
|
2017-06-16 05:29:19 +00:00
|
|
|
return [
|
2017-08-05 22:20:07 +00:00
|
|
|
'id' => $faker->unique()->randomNumber(),
|
2017-11-03 23:16:49 +00:00
|
|
|
'uuid' => $faker->unique()->uuid,
|
2017-06-16 05:29:19 +00:00
|
|
|
'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,
|
|
|
|
'daemonSecret' => $faker->uuid,
|
|
|
|
'daemonListen' => 8080,
|
|
|
|
'daemonSFTP' => 2022,
|
|
|
|
'daemonBase' => '/srv/daemon',
|
|
|
|
];
|
|
|
|
});
|
2017-07-23 01:15:01 +00:00
|
|
|
|
2017-12-17 19:07:38 +00:00
|
|
|
$factory->define(Pterodactyl\Models\Nest::class, function (Faker $faker) {
|
2017-08-16 03:21:47 +00:00
|
|
|
return [
|
2017-08-27 00:58:24 +00:00
|
|
|
'id' => $faker->unique()->randomNumber(),
|
2017-10-07 02:22:32 +00:00
|
|
|
'uuid' => $faker->unique()->uuid,
|
|
|
|
'author' => 'testauthor@example.com',
|
2017-08-16 03:21:47 +00:00
|
|
|
'name' => $faker->word,
|
|
|
|
'description' => null,
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
2017-12-17 19:07:38 +00:00
|
|
|
$factory->define(Pterodactyl\Models\Egg::class, function (Faker $faker) {
|
2017-08-12 21:30:27 +00:00
|
|
|
return [
|
|
|
|
'id' => $faker->unique()->randomNumber(),
|
2017-10-05 03:41:15 +00:00
|
|
|
'uuid' => $faker->unique()->uuid,
|
2017-10-07 22:21:41 +00:00
|
|
|
'nest_id' => $faker->unique()->randomNumber(),
|
2017-08-12 21:30:27 +00:00
|
|
|
'name' => $faker->name,
|
2017-08-13 19:55:09 +00:00
|
|
|
'description' => implode(' ', $faker->sentences(3)),
|
2017-10-05 04:42:04 +00:00
|
|
|
'startup' => 'java -jar test.jar',
|
2017-08-12 21:30:27 +00:00
|
|
|
];
|
|
|
|
});
|
|
|
|
|
2017-12-17 19:07:38 +00:00
|
|
|
$factory->define(Pterodactyl\Models\EggVariable::class, function (Faker $faker) {
|
2017-07-23 01:15:01 +00:00
|
|
|
return [
|
2017-08-05 22:20:07 +00:00
|
|
|
'id' => $faker->unique()->randomNumber(),
|
2017-07-23 01:15:01 +00:00
|
|
|
'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',
|
2017-08-05 22:20:07 +00:00
|
|
|
];
|
2017-07-23 01:15:01 +00:00
|
|
|
});
|
|
|
|
|
2017-10-07 04:57:53 +00:00
|
|
|
$factory->state(Pterodactyl\Models\EggVariable::class, 'viewable', function () {
|
2017-07-23 01:15:01 +00:00
|
|
|
return ['user_viewable' => 1];
|
|
|
|
});
|
|
|
|
|
2017-10-07 04:57:53 +00:00
|
|
|
$factory->state(Pterodactyl\Models\EggVariable::class, 'editable', function () {
|
2017-07-23 01:15:01 +00:00
|
|
|
return ['user_editable' => 1];
|
|
|
|
});
|
2017-08-21 01:02:24 +00:00
|
|
|
|
2017-12-17 19:07:38 +00:00
|
|
|
$factory->define(Pterodactyl\Models\Pack::class, function (Faker $faker) {
|
2017-08-21 01:02:24 +00:00
|
|
|
return [
|
|
|
|
'id' => $faker->unique()->randomNumber(),
|
2017-10-07 23:08:19 +00:00
|
|
|
'egg_id' => $faker->randomNumber(),
|
2017-08-21 01:02:24 +00:00
|
|
|
'uuid' => $faker->uuid,
|
|
|
|
'name' => $faker->word,
|
|
|
|
'description' => null,
|
|
|
|
'version' => $faker->randomNumber(),
|
|
|
|
'selectable' => 1,
|
|
|
|
'visible' => 1,
|
|
|
|
'locked' => 0,
|
|
|
|
];
|
|
|
|
});
|
2017-08-24 02:34:11 +00:00
|
|
|
|
2017-12-17 19:07:38 +00:00
|
|
|
$factory->define(Pterodactyl\Models\Subuser::class, function (Faker $faker) {
|
2017-08-24 02:34:11 +00:00
|
|
|
return [
|
|
|
|
'id' => $faker->unique()->randomNumber(),
|
|
|
|
'user_id' => $faker->randomNumber(),
|
|
|
|
'server_id' => $faker->randomNumber(),
|
|
|
|
];
|
|
|
|
});
|
2017-08-27 00:58:24 +00:00
|
|
|
|
2017-12-17 19:07:38 +00:00
|
|
|
$factory->define(Pterodactyl\Models\Allocation::class, function (Faker $faker) {
|
2017-08-27 00:58:24 +00:00
|
|
|
return [
|
|
|
|
'id' => $faker->unique()->randomNumber(),
|
|
|
|
'node_id' => $faker->randomNumber(),
|
|
|
|
'ip' => $faker->ipv4,
|
|
|
|
'port' => $faker->randomNumber(5),
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
2017-12-17 19:07:38 +00:00
|
|
|
$factory->define(Pterodactyl\Models\DatabaseHost::class, function (Faker $faker) {
|
2017-08-27 00:58:24 +00:00
|
|
|
return [
|
|
|
|
'id' => $faker->unique()->randomNumber(),
|
|
|
|
'name' => $faker->colorName,
|
|
|
|
'host' => $faker->unique()->ipv4,
|
|
|
|
'port' => 3306,
|
|
|
|
'username' => $faker->colorName,
|
|
|
|
'password' => Crypt::encrypt($faker->word),
|
|
|
|
'node_id' => $faker->randomNumber(),
|
|
|
|
];
|
|
|
|
});
|
2017-10-24 01:12:15 +00:00
|
|
|
|
2017-12-17 19:07:38 +00:00
|
|
|
$factory->define(Pterodactyl\Models\Database::class, function (Faker $faker) {
|
2017-10-24 01:12:15 +00:00
|
|
|
static $password;
|
|
|
|
|
|
|
|
return [
|
|
|
|
'id' => $faker->unique()->randomNumber(),
|
|
|
|
'server_id' => $faker->randomNumber(),
|
|
|
|
'database_host_id' => $faker->randomNumber(),
|
|
|
|
'database' => str_random(10),
|
|
|
|
'username' => str_random(10),
|
|
|
|
'password' => $password ?: bcrypt('test123'),
|
|
|
|
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
|
|
|
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
|
|
|
];
|
|
|
|
});
|
2017-09-15 04:02:31 +00:00
|
|
|
|
2017-12-17 19:07:38 +00:00
|
|
|
$factory->define(Pterodactyl\Models\Schedule::class, function (Faker $faker) {
|
2017-09-15 04:02:31 +00:00
|
|
|
return [
|
|
|
|
'id' => $faker->unique()->randomNumber(),
|
|
|
|
'server_id' => $faker->randomNumber(),
|
|
|
|
'name' => $faker->firstName(),
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
2017-12-17 19:07:38 +00:00
|
|
|
$factory->define(Pterodactyl\Models\Task::class, function (Faker $faker) {
|
2017-09-15 04:02:31 +00:00
|
|
|
return [
|
|
|
|
'id' => $faker->unique()->randomNumber(),
|
|
|
|
'schedule_id' => $faker->randomNumber(),
|
|
|
|
'sequence_id' => $faker->randomNumber(1),
|
|
|
|
'action' => 'command',
|
|
|
|
'payload' => 'test command',
|
|
|
|
'time_offset' => 120,
|
|
|
|
'is_queued' => false,
|
|
|
|
];
|
|
|
|
});
|
2017-09-25 03:28:16 +00:00
|
|
|
|
2017-12-17 19:07:38 +00:00
|
|
|
$factory->define(Pterodactyl\Models\DaemonKey::class, function (Faker $faker) {
|
2017-09-25 03:28:16 +00:00
|
|
|
return [
|
|
|
|
'id' => $faker->unique()->randomNumber(),
|
|
|
|
'server_id' => $faker->randomNumber(),
|
|
|
|
'user_id' => $faker->randomNumber(),
|
|
|
|
'secret' => 'i_' . str_random(40),
|
2017-09-27 03:16:26 +00:00
|
|
|
'expires_at' => \Carbon\Carbon::now()->addMinutes(10)->toDateTimeString(),
|
2017-09-25 03:28:16 +00:00
|
|
|
];
|
|
|
|
});
|
2017-12-03 20:29:14 +00:00
|
|
|
|
2017-12-17 19:07:38 +00:00
|
|
|
$factory->define(Pterodactyl\Models\APIKey::class, function (Faker $faker) {
|
2017-12-03 20:29:14 +00:00
|
|
|
return [
|
|
|
|
'id' => $faker->unique()->randomNumber(),
|
|
|
|
'user_id' => $faker->randomNumber(),
|
|
|
|
'token' => str_random(Pterodactyl\Models\APIKey::KEY_LENGTH),
|
|
|
|
'memo' => 'Test Function Key',
|
|
|
|
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
|
|
|
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
2017-12-17 19:07:38 +00:00
|
|
|
$factory->define(Pterodactyl\Models\APIPermission::class, function (Faker $faker) {
|
2017-12-03 20:29:14 +00:00
|
|
|
return [
|
|
|
|
'id' => $faker->unique()->randomNumber(),
|
|
|
|
'key_id' => $faker->randomNumber(),
|
|
|
|
'permission' => mb_strtolower($faker->word),
|
|
|
|
];
|
|
|
|
});
|