What is FAIL, what result do you expect and what you get instead?
If you want help - again, show what is expected result and what you get instead?
For example, I do a filter by area_id=7 (see whereHas('area')) but it does not filter, it show all datas instead.
You still didn't provide the expected result, but...
$search = Input::get('search'); // returns '' or null in case there is nothing posted as 'search'
// then this will be always true
->orWhereHas('user', function($q) use($search)
{
$q->where('name', 'like', '%'.$search.'%');
})
// the same goes for this piece
->orWhere('description', 'like', '%'.$search.'%')
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community