From f6109b5d4ad5b61835745d7ca218f4411b6b21ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sat, 11 Aug 2018 21:46:11 +0200 Subject: [PATCH] fix deleting columns --- app/Models/Proposal.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Models/Proposal.php b/app/Models/Proposal.php index 715724a..2acea04 100644 --- a/app/Models/Proposal.php +++ b/app/Models/Proposal.php @@ -137,9 +137,10 @@ class Proposal extends BaseModel 'proposal_id' => $this->getKey(), 'note' => $changeset->note, 'row_count' => 0, // Will be set later when we are sure about the row count - 'columns' => array_map(function(Column $c) { + 'columns' => array_filter(array_map(function(Column $c) { + if ($c->toRemove) return null; return $c->toArray(false); - }, $columns), + }, $columns)), ]); $newRevision->save(); // this gives it an ID, needed to associate rows