1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-22 17:12:30 +01:00
Pterodactyl-Panel/database/Factories/AllocationFactory.php

37 lines
798 B
PHP
Raw Normal View History

<?php
namespace Database\Factories;
use Pterodactyl\Models\Server;
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.
*/
public function definition(): array
{
return [
2021-07-11 19:27:15 +02:00
'ip' => $this->faker->unique()->ipv4,
2022-05-29 23:07:34 +02:00
'port' => $this->faker->unique()->numberBetween(10000, 20000),
];
}
/**
* Attaches the allocation to a specific server model.
*/
public function forServer(Server $server): self
{
return $this->for($server)->for($server->node);
}
}