© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago
danzzz

Dynamic view when using ViewEntry possible?

In an infolist I want to load a view based on "transaction->account->type". My current working solution ist this:

return $infolist
            ->schema([
                ViewEntry::make('paypal')
                    ->visible(function (Transaction $transaction) {
                        return $transaction->account->type == 'paypal';
                    })
                    ->view('filament.infolists.transaction.paypal'),
                ViewEntry::make('bank')
                    ->visible(function (Transaction $transaction) {
                        return $transaction->account->type == 'bank';
                    })
                    ->view('filament.infolists.transaction.bank'),
                ViewEntry::make('cash')
                    ->visible(function (Transaction $transaction) {
                        return $transaction->account->type == 'cash';
                    })
                    ->view('filament.infolists.transaction.cash')
            ]);
return $infolist
            ->schema([
                ViewEntry::make('paypal')
                    ->visible(function (Transaction $transaction) {
                        return $transaction->account->type == 'paypal';
                    })
                    ->view('filament.infolists.transaction.paypal'),
                ViewEntry::make('bank')
                    ->visible(function (Transaction $transaction) {
                        return $transaction->account->type == 'bank';
                    })
                    ->view('filament.infolists.transaction.bank'),
                ViewEntry::make('cash')
                    ->visible(function (Transaction $transaction) {
                        return $transaction->account->type == 'cash';
                    })
                    ->view('filament.infolists.transaction.cash')
            ]);


is there a better way?

an other alternative may is to load the final view (paypal, bank or cash) in a base view ...
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

ViewEntry - poll
FilamentFFilament / ❓┊help
3y ago
ViewEntry Style doesn't work
FilamentFFilament / ❓┊help
4mo ago
Filter on view page possible?
FilamentFFilament / ❓┊help
3y ago