diff --git a/app/Models/Environment.php b/app/Models/Environment.php index 1e32dd666..86e784ef2 100644 --- a/app/Models/Environment.php +++ b/app/Models/Environment.php @@ -12,5 +12,9 @@ public function databases() { return $this->hasMany(Database::class); } + public function services() + { + return $this->hasMany(Service::class); + } } diff --git a/app/Models/Service.php b/app/Models/Service.php new file mode 100644 index 000000000..e3df5dfa7 --- /dev/null +++ b/app/Models/Service.php @@ -0,0 +1,16 @@ +belongsTo(Environment::class); + } + public function destination() + { + return $this->morphTo(); + } +} diff --git a/database/migrations/2023_03_27_083621_create_services_table.php b/database/migrations/2023_03_27_083621_create_services_table.php new file mode 100644 index 000000000..a5c10c0b0 --- /dev/null +++ b/database/migrations/2023_03_27_083621_create_services_table.php @@ -0,0 +1,32 @@ +id(); + $table->string('uuid')->unique(); + $table->string('name'); + + $table->morphs('destination'); + $table->foreignId('environment_id'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('services'); + } +}; diff --git a/database/migrations/2023_03_27_085020_create_standalone_dockers_table.php b/database/migrations/2023_03_27_085022_create_standalone_dockers_table.php similarity index 100% rename from database/migrations/2023_03_27_085020_create_standalone_dockers_table.php rename to database/migrations/2023_03_27_085022_create_standalone_dockers_table.php diff --git a/database/migrations/2023_03_27_085022_create_swarm_dockers_table.php b/database/migrations/2023_03_27_085023_create_swarm_dockers_table.php similarity index 100% rename from database/migrations/2023_03_27_085022_create_swarm_dockers_table.php rename to database/migrations/2023_03_27_085023_create_swarm_dockers_table.php diff --git a/database/seeders/ApplicationSeeder.php b/database/seeders/ApplicationSeeder.php index 8a3273987..ded229b65 100644 --- a/database/seeders/ApplicationSeeder.php +++ b/database/seeders/ApplicationSeeder.php @@ -28,7 +28,7 @@ public function run(): void ]); Application::create([ 'id' => 2, - 'name' => 'My Second application', + 'name' => 'My second application (Swarm)', 'environment_id' => $environment_1->id, 'destination_id' => $swarm_docker_1->id, 'destination_type' => SwarmDocker::class, diff --git a/database/seeders/DBSeeder.php b/database/seeders/DBSeeder.php index 950eba2fd..68bbeb01c 100644 --- a/database/seeders/DBSeeder.php +++ b/database/seeders/DBSeeder.php @@ -20,7 +20,5 @@ public function run(): void 'destination_id' => $standalone_docker_1->id, 'destination_type' => StandaloneDocker::class, ]); - - } } diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 2f5b6686c..674153fd0 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -23,6 +23,7 @@ public function run(): void KubernetesSeeder::class, ApplicationSeeder::class, DBSeeder::class, + ServiceSeeder::class, ]); } } diff --git a/database/seeders/ServiceSeeder.php b/database/seeders/ServiceSeeder.php new file mode 100644 index 000000000..e3e1ea3d8 --- /dev/null +++ b/database/seeders/ServiceSeeder.php @@ -0,0 +1,27 @@ + 1, + 'name'=> "My first database", + 'environment_id' => $environment_1->id, + 'destination_id' => $standalone_docker_1->id, + 'destination_type' => StandaloneDocker::class, + ]); + } +} diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index f76d0769b..78f3675fd 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -5,31 +5,40 @@

Projects