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-15 16:37:36 +02:00
parent 55d253aa7b
commit c62f8ec676
2 changed files with 16 additions and 12 deletions

View File

@ -5,6 +5,7 @@ namespace App\Form\Resources;
use App\Form\Models\Form; use App\Form\Models\Form;
use App\Form\Models\Participant; use App\Form\Models\Participant;
use Illuminate\Http\Resources\Json\JsonResource; use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Collection;
/** /**
* @mixin Participant * @mixin Participant
@ -31,23 +32,24 @@ class ParticipantResource extends JsonResource
*/ */
public static function meta(Form $form): array public static function meta(Form $form): array
{ {
/** @var Collection<int, array<string, mixed>> */
$fieldData = $form->getFields()
->map(fn ($field) => [
'name' => $field->name,
'base_type' => class_basename($field),
'id' => $field->key,
'display_attribute' => $field->getDisplayAttribute(),
]);
return [ return [
'form_meta' => $form->meta, 'form_meta' => $form->meta,
'links' => [ 'links' => [
'update_form_meta' => route('form.update-meta', ['form' => $form]), 'update_form_meta' => route('form.update-meta', ['form' => $form]),
], ],
'columns' => $form->getFields() 'columns' => $fieldData->push([
->map(fn ($field) => [ 'name' => 'Registriert am',
'name' => $field->name, 'id' => 'created_at',
'base_type' => class_basename($field), 'display_attribute' => 'created_at_display'
'id' => $field->key, ])
'display_attribute' => $field->getDisplayAttribute(),
])
->push([
'name' => 'Registriert am',
'id' => 'created_at',
'display_attribute' => 'created_at_display'
])
]; ];
} }
} }

View File

@ -22,6 +22,8 @@ use App\Form\Enums\SpecialType;
* @method self forMembers(bool $forMembers) * @method self forMembers(bool $forMembers)
* @method self specialType(SpecialType $specialType) * @method self specialType(SpecialType $specialType)
* @method self hint(string $hint) * @method self hint(string $hint)
* @method self min(int $min)
* @method self max(int $max)
*/ */
class FormtemplateFieldRequest extends RequestFactory class FormtemplateFieldRequest extends RequestFactory
{ {