@@ -116,19 +116,19 @@ protected function processAttributes(string $className): void
116116 $ class = new ReflectionClass ($ className );
117117
118118 $ classRouteAttributes = new ClassRouteAttributes ($ class );
119-
119+
120120 $ groups = $ classRouteAttributes ->groups ();
121-
121+
122122 foreach ($ groups as $ group ) {
123123 $ router = $ this ->router ;
124124 $ router ->group ($ group , fn () => $ this ->registerRoutes ($ class , $ classRouteAttributes ));
125125 }
126-
126+
127127 if ($ classRouteAttributes ->resource ()) {
128128 $ this ->registerResource ($ class , $ classRouteAttributes );
129129 }
130130
131-
131+
132132 }
133133
134134 protected function registerResource (ReflectionClass $ class , ClassRouteAttributes $ classRouteAttributes ): void
@@ -174,6 +174,9 @@ protected function registerRoutes(ReflectionClass $class, ClassRouteAttributes $
174174
175175 $ this ->addMiddlewareToRoute ($ classRouteAttributes , $ attributeClass , $ route );
176176
177+ $ this ->addWithoutMiddlewareToRoute ($ classRouteAttributes , $ attributeClass , $ route );
178+
179+
177180 $ this ->setWithTrashedIfAvailable ($ classRouteAttributes , $ withTrashedAttribute , $ route );
178181
179182
@@ -264,6 +267,18 @@ public function addMiddlewareToRoute(ClassRouteAttributes $classRouteAttributes,
264267 $ route ->middleware ([...$ this ->middleware , ...$ classMiddleware , ...$ methodMiddleware ]);
265268 }
266269
270+ /**
271+ * @param ClassRouteAttributes $classRouteAttributes
272+ * @param Route $attributeClass
273+ * @param \Illuminate\Routing\Route $route
274+ * @return void
275+ */
276+ private function addWithoutMiddlewareToRoute (ClassRouteAttributes $ classRouteAttributes , Route $ attributeClass , \Illuminate \Routing \Route $ route ): void
277+ {
278+ $ methodWithoutMiddleware = $ attributeClass ->withoutMiddleware ;
279+ $ route ->withoutMiddleware ($ methodWithoutMiddleware );
280+ }
281+
267282 /**
268283 * @param ClassRouteAttributes $classRouteAttributes
269284 * @param mixed $defaultAttributes
0 commit comments