© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
1 reply
daljo25

error when loading data from a relationship in a select element

I want to load the names of the volunteer table in a select of the beneficiary resource but it gives me the following error

Filament\Support\Services\RelationshipJoiner::prepareQueryForNoConstraints(): Argument #1 ($relationship) must be of type Illuminate\Database\Eloquent\Relations\Relation, null given, called in C:\Users\daljo\dev\Caritas\vendor\filament\forms\src\Components\Select.php on line 773
Filament\Support\Services\RelationshipJoiner::prepareQueryForNoConstraints(): Argument #1 ($relationship) must be of type Illuminate\Database\Eloquent\Relations\Relation, null given, called in C:\Users\daljo\dev\Caritas\vendor\filament\forms\src\Components\Select.php on line 773


code of resource

Forms\Components\Select::make('Volunteers_id')
     ->required()
     ->relationship('Volunteers', 'name')
     ->searchable()
     ->preload(),
Forms\Components\Select::make('Volunteers_id')
     ->required()
     ->relationship('Volunteers', 'name')
     ->searchable()
     ->preload(),


model beneficiaries

public function volunteer(): BelongsTo
    {
        return $this->belongsTo(Volunteers::class);
    }
public function volunteer(): BelongsTo
    {
        return $this->belongsTo(Volunteers::class);
    }


model volunteers

public function beneficiaries() : HasMany
    {
        return $this->hasMany(Beneficiaries::class);
    }
public function beneficiaries() : HasMany
    {
        return $this->hasMany(Beneficiaries::class);
    }


In advance, sorry for my bad English and if it is not well written, the post is my first time.
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

Loading data from a relationship in a form
FilamentFFilament / ❓┊help
3y ago
ManyToMany Relationship via Select element
FilamentFFilament / ❓┊help
2y ago
Not Loading Data from Fieldset->relationship()
FilamentFFilament / ❓┊help
2y ago
Get relationship Select record data from $get
FilamentFFilament / ❓┊help
3y ago