Get stream entries if checkbox is checked
Created 3 years ago by finnitoI have a stream where one of the fields is a set of checkboxes that are used to assign and document to one or more categories. How can I make an entries() query to extract documents which have a particular checkbox? This is what I've tried:
{% set files = entries("ucandance", "documents") .where(request_segment(2), "in", "tags") .get() %}
But .where() takes the arguments in the opposite order.
where
should be what you use but you want to useLIKE
since checkboxes store a serialized value array:Keep in mind
where
works exactly like the query builder in Laravel. You're basically using the query builder at this point. The segment part is basically just a wildcard to match the string in the column which again is serialized.Hope this helps!