Closed happymacarts closed 2 years ago
Hi @happymacarts
I think you are trying to do a query on a relation? You can use the whereHas for that.
Check whereHas
public function query($query)
{
if ($this->getFilter('filter') && (int) $this->getFilter('filter') === 2) {
return $query->whereHas('info', function($query){
$query->whereNull('archive');
})->with('user', 'status', 'info')
->withTrashed();
}
return $query->whereDoesntHave('info', function($query){
$query->whereNull('archive');
})
->with('user', 'status', 'info')
->withTrashed();
}
exactly what I needed thx
for example my model has a relationship "info" if i wanted to modify the filter "where info.archive is null" what would that look like