whereHas('user', function ($query) { $query->where('app_version', Constant::STATUS_ZERO); })->get(); $pushData = []; foreach ($users as $user) { $pushData['userToken'] = $user->token ?? []; $pushData['title'] = trans('notifications.notification_title.new_app'); $pushData['body'] = trans('notifications.new_application.download_app', ['url' => 'https://play.google.com/store/apps/details?id=com.globaljain.android']); $extraData = []; $extraData['user_id'] = $user->user_id ?? ''; $extraData['user_name'] = $user->user->name ?? ''; $extraData['url'] = env('NEW_APP_URL'); $extraData['type'] = trans('notifications.app_notification_type.new-app'); $extraData['created_at'] = date('Y/m/d H:i:s'); $extraData['os'] = $user->os ? getPlatform($user->os) : []; $pushData['extraData'] = $extraData ?? []; $this->pushNotification($pushData, $extraData); //Store notification for send back sant $notificationData = []; $notificationData['body'] = trans('notifications.new_application.download_app', ['url' => 'https://play.google.com/store/apps/details?id=com.globaljain.android']); $notificationData['type'] = trans('notifications.app_notification_type.new-app'); $notificationData['title'] = trans('notifications.notification_title.new_app'); $notificationData['user_id'] = $user->user_id ?? '';; $extraNotificationData = []; $extraNotificationData['user_id'] = $user->user_id ?? ''; $extraNotificationData['name'] = $user->user->name ?? ''; $extraNotificationData['created_at'] = date('Y/m/d H:i:s'); $notificationData['extraNotificationData'] = $extraNotificationData ?? []; $this->storeNotification($notificationData); //Unread count increament unreadNotificationCounter($user->user_id); } } catch (\Exception $ex) { Log::error($ex); } } }