Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function sendPushNotification($users_id1, $users_id2, $name1, $posts_id, $message_id, $title, $s_msg, $device_token, $type, $badge) {
- $optionBuiler = new OptionsBuilder();
- $optionBuiler->setTimeToLive(60*20);
- $optionBuiler->setPriority('high');
- $notificationBuilder = new PayloadNotificationBuilder($title);
- $notificationBuilder->setBody($s_msg)->setSound('default');
- $badge=11;
- $dataBuilder = new PayloadDataBuilder();
- $dataBuilder->addData([ 'u' => $users_id1,
- 'name' => $name1,
- 'p' => $posts_id,
- 'm' => $message_id,
- 's_msg' => $s_msg,
- 'type' => $type,
- 'badge' => $badge
- ]);
- $option = $optionBuiler->build();
- $notification = $notificationBuilder->build();
- $data = $dataBuilder->build();
- $downstreamResponse = FCM::sendTo($device_token, $option, $notification, $data);
- return 1;
- // return new JsonResponse(array('status'=>'1','sucess'=>$downstreamResponse->numberSuccess(),'fail'=> $downstreamResponse->numberFailure(),'msg'=>$downstreamResponse->tokensWithError()),200);
- }
Add Comment
Please, Sign In to add comment