Refactor Application model and migration

This commit is contained in:
Andras Bacsai 2024-02-06 17:37:07 +01:00
parent 78b194cb16
commit 13bceb934f
2 changed files with 20 additions and 2 deletions

View File

@ -215,6 +215,26 @@ public function portsMappingsArray(): Attribute
);
}
public function status(): Attribute
{
return Attribute::make(
set: function ($value) {
if ($this->additional_networks->count() === 0) {
return $value;
} else {
return 'complex';
}
},
get: function ($value) {
if ($this->additional_networks->count() === 0) {
return $value;
} else {
return 'complex';
}
},
);
}
public function portsExposesArray(): Attribute
{

View File

@ -20,7 +20,6 @@ public function up(): void
});
Schema::table('applications', function (Blueprint $table) {
$table->dropColumn('additional_destinations');
$table->text('complex_status')->nullable();
});
}
@ -32,7 +31,6 @@ public function down(): void
Schema::dropIfExists('additional_destinations');
Schema::table('applications', function (Blueprint $table) {
$table->string('additional_destinations')->nullable()->after('destination');
$table->dropColumn('complex_status');
});
}
};