28 lines
620 B
PHP
28 lines
620 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Services\Wireguard\Keypair;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class VpnPeerFactory extends Factory
|
|
{
|
|
public function definition(): array
|
|
{
|
|
static $octet = 20;
|
|
|
|
return [
|
|
'name' => $this->faker->userName(),
|
|
'public_key' => Keypair::generate()->publicKey,
|
|
'allowed_ip' => '10.66.0.'.($octet++),
|
|
'enabled' => true,
|
|
'present' => true,
|
|
];
|
|
}
|
|
|
|
public function blocked(): static
|
|
{
|
|
return $this->state(['enabled' => false, 'present' => false]);
|
|
}
|
|
}
|