laravel 5.1 access package config values

I’m starting a package on laravel 5.1. Up till now using laravel 4.2

I’ve been able to publish the package config file using the following in the boot method of the service provider for my package as described in the documents:

public function boot()
{
    $this->publishes([
        __DIR__ . '/config/config.php' =>   config_path('/packages/longestdrive/googlecal/googlecal.php'),
    ]);

Now I’m trying to access the items in this config using:

config('googlecal.client_id');

This however returns null

If I simply do: config() I get a full array of the config arrays and can see my package config file there.

If I then do: config('longestdrive.googlecal.googlecal.client_id') I can access the variable.

In L4.2 I did not need to add effectively the full path to the variable.

Have I missed something to enable me to simply do: config('googlecal.client_id')

Thanks


Source: laravel

Leave a Reply