nova-child-select icon indicating copy to clipboard operation
nova-child-select copied to clipboard

N+1 Query

Open shineirvin opened this issue 6 years ago • 1 comments

public function fields()
{
        return [
            Select::make('Provider', 'provider')
                ->options((\App\Person::all())
                ->rules('required')
 }

\App\Person::all() is causing N+1 Query, How do I prevent it ?

shineirvin avatar Jul 26 '19 09:07 shineirvin

You can't prevent n+1 query in this field. Normally select field is used in Form page, you don't need to prevent it. If in special page that you have select fields in Table, I will use cache('person') instead of Persion::all().

alvinhu avatar Jul 30 '19 15:07 alvinhu