Path: blob/1.0-develop/database/Factories/AllocationFactory.php
7458 views
<?php12namespace Database\Factories;34use Pterodactyl\Models\Server;5use Pterodactyl\Models\Allocation;6use Illuminate\Database\Eloquent\Factories\Factory;78class AllocationFactory extends Factory9{10/**11* The name of the factory's corresponding model.12*13* @var string14*/15protected $model = Allocation::class;1617/**18* Define the model's default state.19*/20public function definition(): array21{22return [23'ip' => $this->faker->unique()->ipv4,24'port' => $this->faker->unique()->numberBetween(1024, 65535),25];26}2728/**29* Attaches the allocation to a specific server model.30*/31public function forServer(Server $server): self32{33return $this->for($server)->for($server->node);34}35}363738