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 ?
I have a scope which is created using whereHas :
now if I call this scope before the search scope it works, but calling the search scope before the vendorOf() one will fail.
Any idea why and how to solve this issue ?