© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
4 replies
Mina

hiddenOn returns an error when creating a resource

So, on my app I had to add creation of whitelists. Before that you could only view the resource, you couldn't create it or edit it. Now, we had to add the creation of record. As you know, the view, edit and create are all using the same form. When creating a record now, we get an error:
App\Filament\Resources\WhitelistResource::App\Filament\Resources\{closure}(): Argument #1 ($record) must be of type App\Models\v1\Whitelist, null given, called in /var/task/vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35
App\Filament\Resources\WhitelistResource::App\Filament\Resources\{closure}(): Argument #1 ($record) must be of type App\Models\v1\Whitelist, null given, called in /var/task/vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35


I've looked through the code and realized it's because of this part:
Forms\Components\TextInput::make('planRelation.name')
                    ->label('Plan')
                    ->formatStateUsing((function (Whitelist $record): string {
                        return $record->planRelation->name ?? '';
                    }))
                    ->hiddenOn(['edit', 'create']),
Forms\Components\TextInput::make('planRelation.name')
                    ->label('Plan')
                    ->formatStateUsing((function (Whitelist $record): string {
                        return $record->planRelation->name ?? '';
                    }))
                    ->hiddenOn(['edit', 'create']),


Right now we only removed it. My question is, how to actually make this work so that I have a planRelation name in the View page?
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

Creating a widget returns an error.
FilamentFFilament / ❓┊help
17mo ago
Specify a directory when creating a resource
FilamentFFilament / ❓┊help
2y ago
Accessing parent resource when creating nested resource
FilamentFFilament / ❓┊help
6mo ago
Weird behavior when creating resource
FilamentFFilament / ❓┊help
2y ago