Files
pterodactyl-panel/database/Factories/NodeFactory.php
T

56 lines
1.4 KiB
PHP
Raw Normal View History

2021-01-23 12:09:16 -08:00
<?php
2026-10-05 18:10:18 -04:00
declare(strict_types=1);
2021-01-23 12:09:16 -08:00
namespace Database\Factories;
2026-10-05 18:10:18 -04:00
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Crypt;
2021-01-23 12:09:16 -08:00
use Illuminate\Support\Str;
2026-10-05 18:10:18 -04:00
use Pterodactyl\Models\Location;
2021-01-23 12:09:16 -08:00
use Pterodactyl\Models\Node;
2026-10-05 18:10:18 -04:00
use Ramsey\Uuid\Uuid;
2021-01-23 12:09:16 -08:00
2026-10-05 18:10:18 -04:00
/**
* @extends Factory<Node>
*/
2021-01-23 12:09:16 -08:00
class NodeFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Node::class;
/**
* Define the model's default state.
*/
public function definition(): array
{
return [
'uuid' => Uuid::uuid4()->toString(),
'public' => true,
2026-10-05 18:10:18 -04:00
'name' => 'FactoryNode_'.Str::random(10),
'fqdn' => fake()->unique()->ipv4(),
2021-01-23 12:09:16 -08:00
'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' => Crypt::encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH)),
'daemonListen' => 8080,
'daemonSFTP' => 2022,
'daemonBase' => '/var/lib/pterodactyl/volumes',
];
}
2026-10-05 18:10:18 -04:00
public function withLocation(): self
{
return $this->for(Location::factory());
}
2021-01-23 12:09:16 -08:00
}