user(); $currentRole = $user->userRole(); if (!in_array($currentRole, $roles)) { throw new \App\Exceptions\RuntimeException('没有权限'); } return $next($request); } }