|
@@ -49,12 +49,13 @@ class AuthTokenMiddleware implements MiddlewareInterface
|
|
|
return $authInfo['tokenData'];
|
|
|
});
|
|
|
}
|
|
|
- $request->isLogin = function () use (&$authInfo) {
|
|
|
+ $request->macro('isLogin', function () use (&$authInfo) {
|
|
|
return !is_null($authInfo);
|
|
|
- };
|
|
|
- $request->uid = function () use (&$authInfo) {
|
|
|
+ });
|
|
|
+ $request->macro('uid', function () use (&$authInfo) {
|
|
|
return is_null($authInfo) ? 0 : (int)$authInfo['user']->uid;
|
|
|
- };
|
|
|
+ });
|
|
|
+
|
|
|
|
|
|
return $next($request);
|
|
|
}
|