Kirin 6 dní pred
rodič
commit
12f8d8393d

+ 5 - 4
app/http/middleware/api/AuthTokenMiddleware.php

@@ -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);
     }