brozot / Laravel-FCM

Laravel-FCM is an easy to use package working with both Laravel and Lumen for sending push notification with Firebase Cloud Messaging (FCM).
MIT License
889 stars 409 forks source link

Laravel 8 #203

Open exzachlyvv opened 4 years ago

exzachlyvv commented 4 years ago

After upgrading to Laravel 8, seeing this error:

Undefined property: LaravelFCM\FCMManager::$app

ArabAgile commented 4 years ago

Quick (dirty-way) fix (until official library upgrade) is to change FCMManager.php to:

class FCMManager extends Manager
{
    public function getDefaultDriver()
    {
        return config('fcm.driver');
    }

    protected function createHttpDriver()
    {
        $config = config('fcm.http');

        return new Client(['timeout' => $config[ 'timeout' ]]);
    }
}
zach-lum-fm commented 4 years ago

I have a fork with this fix in it if anyone wants to use it:

https://github.com/zach-lum-fm/Laravel-FCM

In composer.json:

"repositories": [
    {
        "type": "vcs",
        "url":  "git@github.com:zach-lum-fm/laravel-fcm.git"
    }
],
andynguyen-adamo commented 3 years ago

Hey @zach-lum-fm I've added your repo to my composer.json "repositories": [ { "type": "package", "package": { "name": "zach-lum-fm/laravel-fcm", "version": "2", "type": "git", "source": { "url": "https://github.com/zach-lum-fm/Laravel-FCM", "type": "git", "reference": "master" } } } ], and composer cloned the source code to vendor/zach-lum-fm/laravel-fcm

But i got an error

Class 'LaravelFCM\FCMServiceProvider' not found

How to let Laravel recognize our vendor/zach-lum-fm/laravel-fcm ?

TaPTaK commented 3 years ago

Hey @zach-lum-fm I've added your repo to my composer.json "repositories": [ { "type": "package", "package": { "name": "zach-lum-fm/laravel-fcm", "version": "2", "type": "git", "source": { "url": "https://github.com/zach-lum-fm/Laravel-FCM", "type": "git", "reference": "master" } } } ], and composer cloned the source code to vendor/zach-lum-fm/laravel-fcm

But i got an error

Class 'LaravelFCM\FCMServiceProvider' not found

How to let Laravel recognize our vendor/zach-lum-fm/laravel-fcm ?

replace "repositories": [ { "type": "vcs", "url": "git@github.com:zach-lum-fm/laravel-fcm.git" } ], and in "require" section "apility/laravel-fcm": "dev-master"

andynguyen-adamo commented 3 years ago

Amazing! It worked. Thank you so much @TaPTaK

hemantachhami19 commented 3 years ago

+1