Fixes for client portal constraint

This commit is contained in:
David Bomba 2021-05-15 17:00:17 +10:00
parent f9fae690a0
commit 499d9f6b86

View File

@ -32,7 +32,6 @@ class CheckClientExistence
->where('email', auth('contact')->user()->email)
->whereNotNull('email')
->where('email', '<>', '')
->where('account_id', auth('contact')->user()->client->company->account->id)
->whereNull('deleted_at')
->distinct('company_id')
->distinct('email')
@ -40,6 +39,9 @@ class CheckClientExistence
->whereHas('client', function ($query) {
return $query->whereNull('deleted_at');
})
->whereHas('client.company', function ($query){
return $query->where('account_id', auth('contact')->user()->client->company->account->id);
})
->get();
if (count($multiple_contacts) == 0) {