In the index of my user controller I have the following:
return QueryBuilder::for(User::class)
->with('phoneNumbers')
->allowedIncludes('trashed')
->get();
I was hoping to pass an include param like this:
http://127.0.0.1:8000/v1/users?include=trashed
To append the withTrashed()
global scope to the query.
Is this possible? I am most likely missing something obvious, I have tried a few variations in my testing usually ending up with an error like:
"message": "Call to a member function addEagerConstraints() on boolean",
"exception": "Symfony\\Component\\Debug\\Exception\\FatalThrowableError",
"file": "/Users/timwickstrom/Sites/Wavefire/api/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php",
"line": 522,
For reference: https://github.com/spatie/laravel-query-builderenter link description here