Merge pull request #5703 from beganovich/v5-1405-improve-client-existence-middleware

(v5) Improve CheckClientExistence.php middleware
This commit is contained in:
Benjamin Beganović 2021-05-14 12:34:40 +02:00 committed by GitHub
commit 40592a77c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,6 +31,8 @@ class CheckClientExistence
$multiple_contacts = ClientContact::query() $multiple_contacts = ClientContact::query()
->where('email', auth('contact')->user()->email) ->where('email', auth('contact')->user()->email)
->whereNotNull('email') ->whereNotNull('email')
->where('email', '<>', '')
->where('account_id', auth('contact')->user()->client->company->account->id)
->whereNull('deleted_at') ->whereNull('deleted_at')
->distinct('company_id') ->distinct('company_id')
->distinct('email') ->distinct('email')