Fixed tests
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

This commit is contained in:
philipp lang 2024-04-17 10:53:59 +02:00
parent edffe0ef80
commit 2691894b78
1 changed files with 7 additions and 5 deletions

View File

@ -1,10 +1,8 @@
<?php
use App\Form\Models\Form;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
@ -18,7 +16,9 @@ return new class extends Migration
foreach (DB::table('forms')->get() as $event) {
$config = json_decode($event->config);
$config->sections = array_map(function ($section) {
$section->fields = collect($section->fields)->map(function ($field) {
/** @var Collection<int, mixed> */
$fields = $section->fields;
$section->fields = collect($fields)->map(function ($field) {
if ($field->type === 'DropdownField' || $field->type === 'RadioField') {
$field->allowcustom = false;
}
@ -33,7 +33,9 @@ return new class extends Migration
foreach (DB::table('formtemplates')->get() as $event) {
$config = json_decode($event->config);
$config->sections = array_map(function ($section) {
$section->fields = collect($section->fields)->map(function ($field) {
/** @var Collection<int, mixed> */
$fields = $section->fields;
$section->fields = collect($fields)->map(function ($field) {
if ($field->type === 'DropdownField' || $field->type === 'RadioField') {
$field->allowcustom = false;
}