*/ public function toArray($request) { return [ 'id' => $this->id, 'name' => $this->name, 'from_human' => $this->from->format('d.m.Y'), 'to_human' => $this->to->format('d.m.Y'), 'from' => $this->from->format('Y-m-d'), 'to' => $this->to->format('Y-m-d'), 'excerpt' => $this->excerpt, 'description' => $this->description, 'mail_top' => $this->mail_top, 'mail_bottom' => $this->mail_bottom, 'registration_from' => $this->registration_from?->format('Y-m-d H:i:s'), 'registration_until' => $this->registration_until?->format('Y-m-d H:i:s'), 'config' => $this->config, 'participants_count' => $this->participants_count, 'is_active' => $this->is_active, 'is_private' => $this->is_private, 'has_nami_field' => $this->getFields()->hasNamiField(), 'export' => $this->export, 'needs_prevention' => $this->needs_prevention, 'links' => [ 'participant_index' => route('form.participant.index', ['form' => $this->getModel(), 'parent' => null]), 'participant_root_index' => route('form.participant.index', ['form' => $this->getModel(), 'parent' => -1]), 'update' => route('form.update', ['form' => $this->getModel()]), 'destroy' => route('form.destroy', ['form' => $this->getModel()]), 'is_dirty' => route('form.is-dirty', ['form' => $this->getModel()]), 'frontend' => str(app(FormSettings::class)->registerUrl)->replace('{slug}', $this->slug), 'export' => route('form.export', ['form' => $this->getModel()]), ] ]; } /** * @return array */ public static function meta(): array { return [ 'base_url' => url(''), 'groups' => Group::forSelect(), 'fields' => Field::asMeta(), 'filter' => FormFilterScope::fromRequest(request()->input('filter', '')), 'links' => [ 'store' => route('form.store'), 'formtemplate_index' => route('formtemplate.index'), ], 'templates' => FormtemplateResource::collection(Formtemplate::get()), 'namiTypes' => NamiType::forSelect(), 'specialTypes' => SpecialType::forSelect(), 'default' => [ 'description' => [], 'is_active' => true, 'is_private' => false, 'name' => '', 'excerpt' => '', 'from' => null, 'to' => null, 'registration_from' => null, 'registration_until' => null, 'mail_top' => [], 'mail_bottom' => [], 'config' => null, 'header_image' => null, 'mailattachments' => [], 'id' => null, 'export' => ExportData::from([]), ], 'section_default' => [ 'name' => '', 'intro' => '', 'fields' => [], ] ]; } }