Update PdAuthServiceProvider.php

This commit is contained in:
候学杰 2019-02-18 15:16:03 +08:00
parent b4b7643789
commit f9e674591a

View File

@ -70,15 +70,14 @@ class PdAuthServiceProvider extends ServiceProvider
}); });
$this->app['router']->get('api/auth/logout', function (Request $request) { $this->app['router']->get('api/auth/logout', function (Request $request) {
$token = $request->header('Authorization', $request->cookie(Authenticate::CookieName));
$cookie = new Cookie(Authenticate::CookieName, '', time()); $cookie = new Cookie(Authenticate::CookieName, '', time());
app('pd.auth')->logout($token);
return response()->json([ return response()->json([
'code' => 0, 'code' => 0,
'message' => '', 'message' => '',
'data' => [], 'data' => [
'url' => isDev() ? 'http://auth.dev.haowumc.com/logout' : 'https://auth.int.haowumc.com/logout'
],
])->withCookie($cookie); ])->withCookie($cookie);
}); });
} }