change guard

This commit is contained in:
候学杰 2018-05-02 10:55:13 +08:00
parent f7e84885bc
commit 5172b975b5
2 changed files with 9 additions and 2 deletions

View File

@ -37,7 +37,7 @@ class Authenticate
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
public function handle($request, Closure $next, $guard = 'auth')
{
//oauth 回调
$code = $request->input('pd_code');

View File

@ -22,7 +22,7 @@ class PdAuthServiceProvider extends ServiceProvider
// should return either a User instance or null. You're free to obtain
// the User instance via an API token or any other method necessary.
$this->app['auth']->viaRequest('api', function (Request $request) {
$this->app['auth']->viaRequest('auth', function (Request $request) {
$token = $request->cookie(Authenticate::CookieName);
@ -38,6 +38,13 @@ class PdAuthServiceProvider extends ServiceProvider
}
return null;
});
//
$config = $this->app['config']['auth'];
if (!isset($config['guards']['auth'])) {
config(['auth.guards.auth' => ['driver' => 'auth']]);
config(['auth.defaults.guard' => 'auth']);
}
}
protected function setupConfig()