Level 102
Try reversed
return $builder->whereDoesntHave('tags', function ($query) use ($value) {
$query->whereIntegerInRaw('id', $value);
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Want to exclude films, what contain certain tags use function like
return $builder->whereHas('tags', function ($query) use ($value) {
$query->whereIntegerNotInRaw('id', $value);
But it worked in interesting way, it exclude just 184 films whichever tag i choose.
If we do vice versa and change whereIntegerNotInRaw to whereIntegerInRaw, there are all show correctly. It shows movies that contain the selected tags.
BUT in my case I want to do that it exclude films with choisen tags. How to do it correctly?
Try reversed
return $builder->whereDoesntHave('tags', function ($query) use ($value) {
$query->whereIntegerInRaw('id', $value);
Please or to participate in this conversation.