Edujugon / PushNotification

PHP and Laravel Package to send push notifications to Android and IOS devices.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

array_key_exists() expects parameter 2 to be array, null given

MoaizP opened this issue · comments

i am getting the following error . i can not trace why this error is generating. i am using this library for push notification in other project it worked but it shows that error in other. Please help.
xcvv

public function initializeConfig($service)
{
    if (function_exists('config_path') &&
        file_exists(config_path('pushnotification.php')) &&
        function_exists('app')
    ) {
        $configuration = app('config')->get('pushnotification');
    } else {
        $configuration = include(__DIR__ . '/Config/config.php');
    }

    if (!array_key_exists($service, $configuration)) {
        throw new PushNotificationException("Service '$service' missed in config/pushnotification.php");
    }
    return $configuration[$service];
}

Hi @MoaizP
Did you publish the pushnotification.php config file?

Hi @Edujugon
yes i publish. with the help of this command
php artisan vendor:publish --provider="Edujugon\PushNotification\Providers\PushNotificationServiceProvider" --tag="config"

What Laravel version are you using?

Could you confirm the pushnotification.php config file was created?

Using laravel version 5.6.39
yes file is created.

Could run the below command and try again?

php artisan config:cache

Hey @MoaizP

Did you try the above command? I believe that should fix your issue

Hey @Edujugon
Yes issue is resolved. You can close this issue.