I have this query:
$query->whereHas($key,function($q) use($option){
$q->whereIn('district', $option);
$q->whereIn('region', $option);
});
But its not working. I want to check district
and region
and i get an array from $option
For AND
use:
$query->whereHas($key,function($q) use($option){
$q->whereIn('district', $option)
->whereIn('region', $option);
});
For OR
:
$query->whereHas($key,function($q) use($option){
$q->whereIn('district', $option)
->orWhereIn('region', $option);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With