FilamentF
Filament17mo ago
Pritbor

MorphToSelect is too slow

MorphToSelect for reading from large database is too slow. Is there any better alternative or any approach i can apply for chunking here. I have Member model which has MorphOne relationship with Company and User models. I need to select member in lets say LeadResource. Below is the code:-

Group::make()
    ->relationship('member')
    ->schema([
            MorphToSelect::make('memberable')
                ->types([
                    MorphToSelect\Type::make(User::class)
                        ->titleAttribute('name'),
                    MorphToSelect\Type::make(Company::class)
                        ->titleAttribute('name')
                ])
                ->label('Member')
                ->required()
                ->searchable()
                ->preload()
                ->optionsLimit(5),
            ]),
Was this page helpful?