config
This commit is contained in:
parent
e902d1f4a0
commit
cbc842fb29
|
@ -36,3 +36,10 @@ $app->register(PdAuth\PdAuthServiceProvider::class);
|
||||||
|
|
||||||
### 配置
|
### 配置
|
||||||
|
|
||||||
|
在项目 .env 文件中增加如下配置
|
||||||
|
|
||||||
|
```
|
||||||
|
PDAUTH_APP_ID=appid
|
||||||
|
PDAUTH_SECRET=123456
|
||||||
|
PDAUTH_HOST=http://auth.dev.haowumc.com
|
||||||
|
```
|
|
@ -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'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user