Have you seen our video tutorials? Check 'em out!

Eager load form relations

pepijn - 1 month ago

Hi,

I know I can eager load stuff in a TableBuilder, using the syntax below, but it seems this is not respected for the FormBuilder. As a result, a ton of queries get executed, and this admin page feels really slow.

How can I eager load form relations ?

 protected $options = [
        'eager' => [
            'translations',
            'relatedModel',
        ],
    ];

ryanthompson - 1 month ago

You can eager load relations using protected $with = [relations]; in your model just like normal Laravel.