© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
9 replies
Bleak (GDB Founder)

BelongsTo is returning all records - ignoring where on relationship?

I have a Task Model with this relationship
  public function taskStatuses() : BelongsTo
    {
        return $this->belongsTo(Status::class, 'status_id')->where('model','Task');
    }
  public function taskStatuses() : BelongsTo
    {
        return $this->belongsTo(Status::class, 'status_id')->where('model','Task');
    }

On my form i have a select

                    Forms\Components\Select::make('status_id')
                        ->relationship('taskStatuses', 'name')
                        ->required(),
                    Forms\Components\Select::make('status_id')
                        ->relationship('taskStatuses', 'name')
                        ->required(),


but its returning all task statuses - not only the ones where the model column = Task?
am i doing something wrong here?
Thanks for any advice!
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

Associate BelongsTo relationship
FilamentFFilament / ❓┊help
3y ago
SpatieMediaLibraryFileUpload is ignoring relationship
FilamentFFilament / ❓┊help
10mo ago
Relationship Manager for BelongsTo and HasMany Relationship
FilamentFFilament / ❓┊help
2y ago
Relationship search in belongsTo select
FilamentFFilament / ❓┊help
3y ago