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 stockholders return; } $new_user = User::findOrFail($payload->data->original->user_id); $owners = Business::findOrFail($payload->business)->owners()->where('id', '!=', $new_user->id)->get(); $users = $owners->prepend($new_user); $this->helper->makeNotif($payload, null, ['business' => request('_business_info')['name'], 'user' => $new_user->name] )->sendNotifications($users, 'critical'); } }