mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2025-12-13 05:26:47 +00:00
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.
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('einundzwanzig_plebs', function (Blueprint $table) {
|
||||
$table->text('archived_application_text')->nullable()->after('application_text');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('einundzwanzig_plebs', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user