© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
8 replies
Vp

call to member function on null in select with relationship

What should be the error here, my code
public function form(Form $form): Form
{
    return $form
        ->schema([
            Forms\Components\Tabs::make('Label')
                ->tabs([
                    Forms\Components\Tabs\Tab::make('Personal details')
                        ->schema([
                            Forms\Components\Grid::make()
                                ->schema([
                                    Forms\Components\Select::make('languages.name')
                                        ->label('Languages')
                                        ->required()
                                        ->multiple()
                                        ->relationship(name: 'languages', titleAttribute: 'name')
                                        ->searchable()
                                        ->preload(),
                                ]),
                        ]),
                ]),
        ]);
}

// relationship
public function languages(): BelongsToMany
{
    return $this->belongsToMany(Language::class);
}

// blade.php
{{ $this->form }}
public function form(Form $form): Form
{
    return $form
        ->schema([
            Forms\Components\Tabs::make('Label')
                ->tabs([
                    Forms\Components\Tabs\Tab::make('Personal details')
                        ->schema([
                            Forms\Components\Grid::make()
                                ->schema([
                                    Forms\Components\Select::make('languages.name')
                                        ->label('Languages')
                                        ->required()
                                        ->multiple()
                                        ->relationship(name: 'languages', titleAttribute: 'name')
                                        ->searchable()
                                        ->preload(),
                                ]),
                        ]),
                ]),
        ]);
}

// relationship
public function languages(): BelongsToMany
{
    return $this->belongsToMany(Language::class);
}

// blade.php
{{ $this->form }}

I also put
$this->form->fill();
$this->form->fill();
in mount()
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

Call to a member function partiallyRender() on null" with partiallyRenderComponentsAfterStateUpdated
FilamentFFilament / ❓┊help
6mo ago
Call to a member function getRelated() on null
FilamentFFilament / ❓┊help
5mo ago
Call to a member function makeGetUtility() on null
FilamentFFilament / ❓┊help
5mo ago
call to a member function relation() on null
FilamentFFilament / ❓┊help
10mo ago