helper = $helper; } /** * Handle the event. * * @param BusinessUserCreate $event * @return void */ public function handle(BusinessUserCreate $event) { $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 stakeholders return; } $new_user = User::findOrFail($payload->data->original->user_id); $owners = Business::findOrFail($payload->business)->owners() ->whereNotIn('id', [$new_user->id, auth()->id()])->get(); $users = $owners->prepend($new_user); $this->helper->makeNotif($payload, null, ['business' => request('_business_info')['name'], 'user' => $new_user->name] )->sendNotifications($users, 'critical'); } }