*/ public function toArray($request) { return [ ...$this->getModel()->getFields()->present(), 'created_at' => $this->created_at->format('Y-m-d H:i:s'), 'created_at_display' => $this->created_at->format('d.m.Y'), 'links' => [ 'destroy' => route('participant.destroy', ['participant' => $this->getModel()]), ] ]; } /** * @return array */ public static function meta(Form $form): array { /** @var Collection> */ $fieldData = $form->getFields() ->map(fn ($field) => [ 'name' => $field->name, 'base_type' => class_basename($field), 'id' => $field->key, 'display_attribute' => $field->getDisplayAttribute(), ]); $filterData = $form->getFields() ->map(fn ($field) => [ ...$field->toArray(), 'base_type' => class_basename($field), ]); return [ 'filter' => ParticipantFilterScope::fromRequest(request()->input('filter', ''))->setForm($form), 'default_filter_value' => ParticipantFilterScope::$nan, 'filters' => $filterData, 'form_meta' => $form->meta, 'links' => [ 'update_form_meta' => route('form.update-meta', ['form' => $form]), ], 'columns' => $fieldData->push([ 'name' => 'Registriert am', 'id' => 'created_at', 'display_attribute' => 'created_at_display' ]) ]; } }