Include without 'count' and 'exists' #990
Replies: 1 comment
-
I found this for this purpose: use Spatie\QueryBuilder\AllowedInclude;
use Spatie\QueryBuilder\Includes\IncludedRelationship;
$posts = QueryBuilder::for(Post::class)
->allowedIncludes([
AllowedInclude::custom('taggable', new IncludedRelationship(), 'taggable'),
]); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hii, good day,
I'm using a polymorphic relationship, and the inclusion of
count
andexists
causes an error. I saw in the documentation a way to add onlycount
orexists
, but I couldn't find a way to add them withoutcount
andexists
. I want to make sure that the items I add toallowedIncludes
do not includecount
andexists
.Do I absolutely need to create a custom class, or is there another solution besides this?
Example:
Incorrect Query with taggableExists:
For example, it could be something like this:
Beta Was this translation helpful? Give feedback.
All reactions