I've a problem doing a query using Eloquent/Laravel.
This is my model: A request has ZERO or multiple offers. An offer can be hide (it's an attribute set on the offer).
What I need to do is to retrieve all requests that either have or don't have offers. BUT, if there's an offer associated, the offer needs to have the attribute hide=false.
I've tried the following, but doesn't seem to work.
$requests = Request::whereDoesntHave('offers', function ($query) use ($hideStatus) {
$query->where('hide', true);
})->get();
I think it's returning to me only requests that don't have offers at all.
Any idea?
FYI, I've Laravel 5.4
Any help would be greatly appreciated!
Thanks