user()->id; // $url = $request->route()->getActionName(); // $controller = strtolower(substr($url,strrpos($url,'\\')+1,strrpos($url,'@')-strrpos($url,'\\')-1)) ; // $action = strtolower(substr($url,strrpos($url,'@')+1)); // $path = $controller.'/'.$action; // $user = User::with('nodeGroup')->find($uid)->toArray(); // if (empty($user['node_group'])) { // return $this->error(ERROR_CODE_PERMISSION_NO,'无权访问'); // } // $node_ids = array_column($user['node_group'],'node_ids'); // foreach ($node_ids as &$val){ // $val = explode(',',$val); // } // $node_ids = arrayValues($node_ids); // if (count($node_ids) == 1 && $node_ids[0] == 'all'){ // return $next($request); // } // $route_uri = array_filter(array_unique(array_column(Node::getRouteUriById($node_ids),'route_uri'))); // if (! in_array($path,$route_uri)){ // return $this->error(ERROR_CODE_PERMISSION_NO,'无权访问'); // } return $next($request); } }