message; $new_user = User::findOrFail($payload->data->original->user_id); $owners = Business::findOrFail($payload->business)->owners()->where('id', '!=', $new_user->id)->get(); $notif = [ 'greeting' => __('notification.'.$payload->data->table_name.'.'.enum('cruds.inverse.'.$payload->data->crud_id.'.singular_name').'.greeting'), 'subject' => __('notification.'.$payload->data->table_name.'.'.enum('cruds.inverse.'.$payload->data->crud_id.'.singular_name').'.subject'), 'title' => __('notification.'.$payload->data->table_name.'.'.enum('cruds.inverse.'.$payload->data->crud_id.'.singular_name').'.title'), 'body' => __('notification.'.$payload->data->table_name.'.'.enum('cruds.inverse.'.$payload->data->crud_id.'.singular_name').'.body', ['business' => request('_business_info')['name'], 'user' => $new_user->name]) ]; $users = $owners->prepend($new_user); Notification::send($users, new MailNotification($notif)); Notification::send($users, new DBNotification($notif)); Notification::send($users, new FcmNotification($notif)); } }