Actually, I think I solved it. I was looking in the wrong part of the documentation.
This seems to work:
$query = Profile::with('user', 'rank', 'game', 'roles', 'gamemodes', 'characters')
->whereHas('user', function($query)
{
if(\Request::get('name'))
$query->where('name', 'LIKE', '%' . \Request::get('name') . '%');
})
->get();
Will come back, if this isn't the case after all.
Bonus Update:
I just realized that if I getXAttribute() I can then append this on my object and don't have to use ->with(). Which allows me to use the built in pagination
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community