Push notification 使用Laravel向android发送推送通知

Push notification 使用Laravel向android发送推送通知,push-notification,laravel-5.8,Push Notification,Laravel 5.8,我想使用laravel 5.8向android和IOS设备发送通知。请帮助我推荐发送推送通知的最佳包 使用此函数时,此错误出现“{“多播id”:650423456439771247,“成功”:0,“失败”:1,“规范id”:0,“结果”:[{“错误”:“无效注册”}]}” public function sendPushNotification($fcm_token, $title, $message, $id = null) { $url = "https://fcm.googlea

我想使用laravel 5.8向android和IOS设备发送通知。请帮助我推荐发送推送通知的最佳包

使用此函数时,此错误出现“{“多播id”:650423456439771247,“成功”:0,“失败”:1,“规范id”:0,“结果”:[{“错误”:“无效注册”}]}”

public function sendPushNotification($fcm_token, $title, $message, $id = null) {

    $url = "https://fcm.googleapis.com/fcm/send";
    $header = [
        'authorization:key=key',
        'content-type: application/json'
    ];

    $postdata = '{
        "to" : "' . $fcm_token . '",
            "notification" : {
                "title":"' . $title . '",
                "text" : "' . $message . '"
            },
        "data" : {
            "id" : "'.$id.'",
            "title":"' . $title . '",
            "description" : "' . $message . '",
            "text" : "' . $message . '",
            "is_read": 0
          }
    }';

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

    $result = curl_exec($ch);
    curl_close($ch);

    return $result;
}