Query model by checkbox list data

Hi. I’ve created a model in a plugin for which I’ve added a checkbox list field. I’ve made the field jsonable. The model is ‘Property’ and the checkbox list is ‘Features’. For example, a property can have checkboxes like “Air conditioning”, “Swimming pool”, etc.
I’d like to query the properties by those features existence. For example, I’d like to get all the properties that have air conditioning. Ideally, a dynamic scope where I could pass the feature… like Property::feature(‘air condicioning’)->get().
But I really couldn’t achieve that. Couldn’t do it using the where clause, nor the whereIn.
Can somebody point me in the right direction on this? I need to make some filters on the frontend and not being able to query the records by feature is holding me back.
Thanks!

Hi @cecilia.ritta

Laravel supports JSON where clauses and here is a link to the documentation:

So in this example:

Property::whereJsonContains('features', 'Air conditioning')->get();

More detailed information can be found here: