From 0308d36e4152ef4884d1185e1e1259cbb636721d Mon Sep 17 00:00:00 2001 From: David Buday Date: Tue, 3 Dec 2024 22:28:03 +0100 Subject: [PATCH] chore: unique --- app/Livewire/Images/Registry/Create.php | 2 +- app/Models/DockerRegistry.php | 5 ----- .../migrations/2024_11_7_203115_create_registries_table.php | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/app/Livewire/Images/Registry/Create.php b/app/Livewire/Images/Registry/Create.php index 144ceb76e..3b13613d8 100644 --- a/app/Livewire/Images/Registry/Create.php +++ b/app/Livewire/Images/Registry/Create.php @@ -8,7 +8,7 @@ use Livewire\Component; class Create extends Component { - #[Validate('required|string|max:255')] + #[Validate('required|string|max:255|unique:docker_registries,name')] public string $name = ''; #[Validate('required|string')] diff --git a/app/Models/DockerRegistry.php b/app/Models/DockerRegistry.php index c3638d0ad..3c0ac3a6f 100644 --- a/app/Models/DockerRegistry.php +++ b/app/Models/DockerRegistry.php @@ -25,9 +25,4 @@ class DockerRegistry extends Model 'custom' => 'Custom Registry' ]; } - - public function applications(): HasMany - { - return $this->hasMany(Application::class, 'docker_registry_id', 'id'); - } } diff --git a/database/migrations/2024_11_7_203115_create_registries_table.php b/database/migrations/2024_11_7_203115_create_registries_table.php index 336598a49..0cfa8874e 100644 --- a/database/migrations/2024_11_7_203115_create_registries_table.php +++ b/database/migrations/2024_11_7_203115_create_registries_table.php @@ -9,7 +9,7 @@ return new class extends Migration { { Schema::create('docker_registries', function (Blueprint $table) { $table->id(); - $table->string('name'); + $table->string('name')->unique(); $table->string('type'); // docker_hub, gcr, ghcr, quay, custom $table->string('url')->nullable(); $table->string('username')->nullable();