|
|
@ -36,11 +36,12 @@ class BusinessUserCreateNotif |
|
|
|
$payload = $event->message; |
|
|
|
if ($payload->data->original->level === enum('levels.inactive.id')) { |
|
|
|
// When user level in business is zero, probably user added to business by system
|
|
|
|
// And not necessary send notification to stockholders
|
|
|
|
// And not necessary send notification to stakeholders
|
|
|
|
return; |
|
|
|
} |
|
|
|
$new_user = User::findOrFail($payload->data->original->user_id); |
|
|
|
$owners = Business::findOrFail($payload->business)->owners()->where('id', '!=', $new_user->id)->get(); |
|
|
|
$owners = Business::findOrFail($payload->business)->owners() |
|
|
|
->whereNotIn('id', [$new_user->id, auth()->id()])->get(); |
|
|
|
|
|
|
|
$users = $owners->prepend($new_user); |
|
|
|
|
|
|
|