Skip to content

no results when calling search() after a whereHas #213

@cyberhicham

Description

@cyberhicham

I have a scope which is created using whereHas :

public function scopeVendorOf($query, Enterprise $customer)
    {
        return $query->whereHas('customers', function ($query) use ($customer) {
            $query->where('id', $customer->id);
        });
    }

now if I call this scope before the search scope it works, but calling the search scope before the vendorOf() one will fail.

Enterprise::search('lucas',null,true,true)->vendorOf($customer)->count()
=> 0
Enterprise::vendorOf($customer)->search('lucas',null,true,true)->count()
=> 1

Any idea why and how to solve this issue ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions