Hello, I am trying to query two hasMany relationships, if an id is in the url I would also like to pull out the data just for that record. Here is what I have so far, however, I am not getting anything returned:
$payments= App::make('mainPayments');
if($id != 0){
$payments= $payments->where('mainPaymentsID','=',$id);
}
$payments->whereHas('otherPayments',function($query) use ($term)
{
$query->whereHas('user',function($query) use ($term)
{
if($term != ''){
$query->where('userName', 'LIKE', "%".$term."%");
}
});
}
)->paginate($this->pageSize);
Can anyone please help?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community