Files
pterodactyl-panel/database/Factories/NodeFactory.php
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

56 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Str;
use Pterodactyl\Models\Location;
use Pterodactyl\Models\Node;
use Ramsey\Uuid\Uuid;
/**
* @extends Factory<Node>
*/
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,
'name' => 'FactoryNode_'.Str::random(10),
'fqdn' => fake()->unique()->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' => Crypt::encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH)),
'daemonListen' => 8080,
'daemonSFTP' => 2022,
'daemonBase' => '/var/lib/pterodactyl/volumes',
];
}
public function withLocation(): self
{
return $this->for(Location::factory());
}
}