Is there a way to limit what rows are being returned when searching pivot data on a many-to-many relation? I have users show up because they match pivot data on the many-to-many table which belongs to other tenants. I'm trying something along the lines of, without any luck.
User::search($q)
->whereHas('tenants', function ($query) use ($tenant) {
$query->where('tenant_id', $tenant->id);
})->get();
Is there a way to limit what rows are being returned when searching pivot data on a many-to-many relation? I have users show up because they match pivot data on the many-to-many table which belongs to other tenants. I'm trying something along the lines of, without any luck.