Select Field Relationship have no limit

I have over 1M record for projects table. when I use the code below it will get all the projects without any limit for it which making the website not responding.

Forms\Components\Select::make('project_id')
    ->searchable()
    ->relationship('project', 'title')



In order to make the select works I need to explicitly use limit in options and getSearchResultsUsing
Forms\Components\Select::make('project_id')
    ->searchable()
    ->options(Project::limit(10)->get()->pluck('title', 'id'))
    ->getSearchResultsUsing(function (?string $search) {
        return Project::where('title', 'like', "%{$search}%")->limit(10)->get()->pluck('title', 'id');
    })


is there any better way to do it? and why there is no limit in relationship method?
Was this page helpful?