© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
1 reply
AlexAnder

Forms\Components\Select with relationship loads all records from DB

My code
...
public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Forms\Components\Select::make('author_id')
                    ->relationship('author', 'name')
...
...
public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Forms\Components\Select::make('author_id')
                    ->relationship('author', 'name')
...

Post.php - Model

...

public function author(): BelongsTo
    {
        return $this
            ->belongsTo(User::class, 'author_id');
    }

...
...

public function author(): BelongsTo
    {
        return $this
            ->belongsTo(User::class, 'author_id');
    }

...

From DB selects all users. Its all table records.. (not enogth RAM) Also from people table is the same..

DB
SELECT "users"."name", "users"."id" FROM "users" ORDER BY "users"."name" ASC
SELECT "users"."name", "users"."id" FROM "users" ORDER BY "users"."name" ASC

And PHP crashed because off memory exhausted..
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

Forms\Components\Select: relationship with json column list?
FilamentFFilament / ❓┊help
3y ago
\Forms\Components\Select
FilamentFFilament / ❓┊help
5mo ago
Run Forms\Components\Select::..->options(..) after another Forms\Components\Select filled
FilamentFFilament / ❓┊help
3y ago
Filament\Forms\Components\Select::isOptionDisabled():
FilamentFFilament / ❓┊help
3y ago