Fixed tests
This commit is contained in:
parent
55d253aa7b
commit
c62f8ec676
|
@ -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'
|
|
||||||
])
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue