I have 5 database rows with the same client_id
, 3 labelled completed, Yes
.
This code pulls through 3 results as expected:
$indGoal = $client->indGoal()->where('completed','=','Yes')->get();
This code pulls through no results: I would expect 2.
$indGoal = $client->indGoal()->where('completed','!=','Yes')->get();
This question suggests adding ->orWhereNull('completed')
- which works, but ignores the client_id
relationship. The request brings through all non-Yes
results, regardless of $client
My Client model for reference:
public function indGoal()
{
return $this->hasMany('App\Models\IndGoal');
}