Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config is not loaded by default #29

Closed
azorgh opened this issue Apr 18, 2016 · 4 comments
Closed

Config is not loaded by default #29

azorgh opened this issue Apr 18, 2016 · 4 comments

Comments

@azorgh
Copy link

azorgh commented Apr 18, 2016

Hello,

I'm trying to seta OAuth with WeChat on my app.
It seems the config file was not loaded, let see :

In the OAuthAuthenticate middleware, in the handle() function, you create a new $wechat like this :

$wechat = app('EasyWeChat\\Foundation\\Application');

But this error was thrown :

Unresolvable dependency resolving [Parameter #0 [ <required> $config ]] in class EasyWeChat\Foundation\Application

If I set the default param to empty array, and load the config file after like this :

public function __construct($config)
    {
        parent::__construct();
        $config = config('wechat');

        $this['config'] = function () use ($config) {
            return new Config($config);
        };

        if ($this['config']['debug']) {
            error_reporting(E_ALL);
        }

        $this->registerProviders();
        $this->registerBase();
        $this->initializeLogger();

        Log::debug('Current configuration:', $config);
    }

It works well.

PR was made : #30

@overtrue
Copy link
Owner

overtrue commented Apr 19, 2016

@pallmallshow Hi, did you forget add the follow line to the providers section of config/app.php:

Overtrue\LaravelWechat\ServiceProvider::class,

@azorgh
Copy link
Author

azorgh commented Apr 19, 2016

Hi @overtrue
Yes I had the service provider in providers array.
I'm on Laravel 5.2.29.

@overtrue
Copy link
Owner

@pallmallshow OK,I got it.

@overtrue
Copy link
Owner

@pallmallshow plz upgrade to version 3.0.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants