Add load balancer (#453)

This commit is contained in:
Saeed Vaziry
2025-01-30 23:52:51 +01:00
committed by GitHub
parent 53e20cbc2a
commit 6966f06b1a
54 changed files with 3128 additions and 1833 deletions

View File

@ -0,0 +1,25 @@
<?php
namespace Database\Factories;
use App\Models\LoadBalancerServer;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
class LoadBalancerServerFactory extends Factory
{
protected $model = LoadBalancerServer::class;
public function definition(): array
{
return [
'load_balancer_id' => $this->faker->randomNumber(), //
'ip' => $this->faker->ipv4(),
'port' => $this->faker->randomNumber(),
'weight' => $this->faker->randomNumber(),
'backup' => $this->faker->boolean(),
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
];
}
}

View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('load_balancer_servers', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('load_balancer_id');
$table->string('ip');
$table->integer('port');
$table->integer('weight')->nullable();
$table->boolean('backup');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('load_balancer_servers');
}
};