Skip to content
Advertisement

Tag: eager-loading

Defining Custom Parameters on Eager-Loaded Elements

I am trying to complete an eager-loading query that will pull in all the related fields on an Entry, even if they are disabled. I am using this as a reference in the docs: https://craftcms.com/docs/3.x/dev/eager-loading-elements.html#defining-custom-parameters-on-eager-loaded-elements I wrote this: But I keep getting a syntax error syntax error, unexpected ‘{‘, expecting ‘]’ Does anyone know what I am doing wrong and

Improve eager loading with multiple relationships of the same type

I have the following model: When I do Message::with([‘sender’, ‘receiver’])->all(), eager loading executes the following queries: That’s almost the least redundant way possbile. But it still loads user 3 and user five two times. Is there a way to further improve this using eloquent and eager loading? Answer No, not really. The example you provided is an exception, nothing tells

Laravel Eager Loading – Unexpected Behavior Difference between Code and Tiner

I am working on building a front-end for managing users / roles / permissions with the Spatie > Permissions package in the backend. A feature I am seeking to implement is selecting a Permission and having this selection then display all Users having the selected permission. Using php artisan tinker, I can use the statement: SpatiePermissionModelPermission::with(“roles.users”)->find(59);, with 59 representing the

Advertisement