This commit is contained in:
候学杰 2018-03-19 11:53:36 +08:00
parent e902d1f4a0
commit cbc842fb29
2 changed files with 9 additions and 2 deletions

View File

@ -36,3 +36,10 @@ $app->register(PdAuth\PdAuthServiceProvider::class);
### 配置 ### 配置
在项目 .env 文件中增加如下配置
```
PDAUTH_APP_ID=appid
PDAUTH_SECRET=123456
PDAUTH_HOST=http://auth.dev.haowumc.com
```

View File

@ -42,7 +42,7 @@ class PdAuthServiceProvider extends ServiceProvider
protected function setupConfig() protected function setupConfig()
{ {
$source = realpath(__DIR__ . '/../config.php'); $source = realpath(__DIR__ . '/../config/pdauth.php');
if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) { if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
$this->publishes([$source => config_path('pdauth.php')], 'pdauth'); $this->publishes([$source => config_path('pdauth.php')], 'pdauth');
@ -55,8 +55,8 @@ class PdAuthServiceProvider extends ServiceProvider
public function register() public function register()
{ {
$this->setupConfig();
$this->app->singleton('pd.auth', function () { $this->app->singleton('pd.auth', function () {
$this->app->configure('pdauth');
return new OAuth(config('pdauth')); return new OAuth(config('pdauth'));
}); });
} }