Support the ongoing development of Laravel.io →
Database Eloquent Architecture
Last updated 1 year ago.
0

No one?

Last updated 1 year ago.
0

What is FAIL, what result do you expect and what you get instead?

Last updated 1 year ago.
0

It returns all datas, instead filtered

Last updated 1 year ago.
0

If you want help - again, show what is expected result and what you get instead?

Last updated 1 year ago.
0

For example, I do a filter by area_id=7 (see whereHas('area')) but it does not filter, it show all datas instead.

Last updated 1 year ago.
0

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.'%')
Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

markuser33 markuser33 Joined 29 Sep 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.