Closed lwhdev closed 7 months ago
报错 内容 :
local.ERROR: Trying to get property 'id' of non-object {"exception":"[object] (ErrorException(code: 0): Trying to get property 'id' of non-object at /home/www/app/Http/Middleware/AdminAuth.php:28)
同样遇到这个问题, 加了清除器没用. 用auth()->user() 好像能解决
| PHP | 7.3.0 | | Swoole | 4.4.16 | | LaravelS | 3.7.36 | | Laravel Framework [local] | 7.30.6 |
Detail description about this issue(error/log) 请问如果使用的Sanctum 轻量级 API 认证,第二次通过request->user()结果为null 这么配置解决?
Some
reproducible
code blocks andsteps
中间件代码
``php
public function handle($request, Closure $next) { $actionName = $request->route()->getActionName(); $actionName = str_replace('App\Http\Controllers\', '', $actionName); $actionName = str_replace('\', '.', $actionName); $actionName = str_replace('@', '.', $actionName); $actionName = str_replace('Controller', '', $actionName); $current_path = strtolower($actionName); // $not_need_auth_list =[];``
327