© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
5 replies
Trauma Zombie

How to show simple array on view page?

Hey guys,
in my model I have simple array attribute
answers
answers
in this format:
[
  "Gender" => "male",
  "Age" => "24",
  ...
]
[
  "Gender" => "male",
  "Age" => "24",
  ...
]


I want to display it in my resource view page:
Infolists\Components\Section::make(__('Answers'))
    ->icon('heroicon-o-question-mark-circle')
    ->schema([
        Infolists\Components\RepeatableEntry::make('answers')
            ->hiddenLabel()
            ->schema([
                Infolists\Components\TextEntry::make('0')
                    ->label(__('Question')),

                Infolists\Components\TextEntry::make('1')
                    ->label(__('Answer')),
            ]),
    ])
    ->collapsible(),
Infolists\Components\Section::make(__('Answers'))
    ->icon('heroicon-o-question-mark-circle')
    ->schema([
        Infolists\Components\RepeatableEntry::make('answers')
            ->hiddenLabel()
            ->schema([
                Infolists\Components\TextEntry::make('0')
                    ->label(__('Question')),

                Infolists\Components\TextEntry::make('1')
                    ->label(__('Answer')),
            ]),
    ])
    ->collapsible(),

Can you help me, how to do it correctly?
Solution
custom view I think

<!-- custom.blade.php -->
<div>
    @foreach ($getState() as $key => $value)
        <div class="flex gap-2">
            <div>{{ $key }}</div>
            <div>{{ $value }}</div>
        </div>
    @endforeach
</div>
<!-- custom.blade.php -->
<div>
    @foreach ($getState() as $key => $value)
        <div class="flex gap-2">
            <div>{{ $key }}</div>
            <div>{{ $value }}</div>
        </div>
    @endforeach
</div>


ViewEntry::make('answers')
    ->view('custom')
ViewEntry::make('answers')
    ->view('custom')
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Show attachaction on view page
FilamentFFilament / ❓┊help
2y ago
How to show multiple photo in view page?
FilamentFFilament / ❓┊help
2y ago
Simple pagination show pages
FilamentFFilament / ❓┊help
12mo ago
cluster navigation doesn't show on view page
FilamentFFilament / ❓┊help
2y ago