From 265ed408397bfd400ab0eb6e2a20891c70337613 Mon Sep 17 00:00:00 2001 From: fsociety Date: Mon, 30 Sep 2024 19:16:06 +0200 Subject: [PATCH] feat: add archived application text field to EinundzwanzigPleb model This commit introduces a new field `archived_application_text` to the EinundzwanzigPleb model. The application text of a Pleb is now archived before the association status is updated and the application text is set to null. A migration file is also added to update the database schema. --- app/Livewire/EinundzwanzigPlebTable.php | 2 ++ ...tion_text_to_einundzwanzig_plebs_table.php | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 database/migrations/2024_09_30_171153_add_copy_field_application_text_to_einundzwanzig_plebs_table.php diff --git a/app/Livewire/EinundzwanzigPlebTable.php b/app/Livewire/EinundzwanzigPlebTable.php index ebc1173..dd688cc 100644 --- a/app/Livewire/EinundzwanzigPlebTable.php +++ b/app/Livewire/EinundzwanzigPlebTable.php @@ -140,8 +140,10 @@ final class EinundzwanzigPlebTable extends PowerGridComponent { $pleb = EinundzwanzigPleb::query()->findOrFail($rowId); $for = $pleb->application_for; + $text = $pleb->application_text; $pleb->association_status = AssociationStatus::from($for); $pleb->application_for = null; + $pleb->archived_application_text = $text; $pleb->application_text = null; $pleb->save(); diff --git a/database/migrations/2024_09_30_171153_add_copy_field_application_text_to_einundzwanzig_plebs_table.php b/database/migrations/2024_09_30_171153_add_copy_field_application_text_to_einundzwanzig_plebs_table.php new file mode 100644 index 0000000..71cdef3 --- /dev/null +++ b/database/migrations/2024_09_30_171153_add_copy_field_application_text_to_einundzwanzig_plebs_table.php @@ -0,0 +1,27 @@ +text('archived_application_text')->nullable()->after('application_text'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('einundzwanzig_plebs', function (Blueprint $table) { + // + }); + } +};