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
Tag: eager-loading
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
Laravel 5.5 How to get eloquent relationship count?
I have three tables as define below User id name Post id text user_id Comments id text post_id This is User model User.php class User { public function post() { return $this-&…
Laravel eager loading phpunit testing
I am trying to do a GET request to retrieve a specific film via the id /GET ‘film/{id}’ etc film_table — id — description this is what is part of the response, what if I’ve many-to-many …