Skip to content

Commit 6b29b97

Browse files
committed
route expose false option
1 parent ca27239 commit 6b29b97

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Extractor/ExposedRoutesExtractor.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ public function getRoutes()
8383
foreach ($collection->all() as $name => $route) {
8484

8585
if ($route->hasOption('expose')) {
86-
$routes->add($name, $route);
86+
87+
$expose = $route->getOption('expose');
88+
89+
if ($expose !== false && $expose !== 'false') {
90+
$routes->add($name, $route);
91+
}
8792
continue;
8893
}
8994

@@ -196,8 +201,12 @@ public function getResources()
196201
*/
197202
public function isRouteExposed(Route $route, $name)
198203
{
199-
return true === $route->hasOption('expose') ||
200-
('' !== $this->pattern && preg_match('#^' . $this->pattern . '$#', $name));
204+
if (false === $route->hasOption('expose')) {
205+
return ('' !== $this->pattern && preg_match('#^' . $this->pattern . '$#', $name));
206+
}
207+
208+
$status = $route->getOption('expose');
209+
return ($status !== false && $status !== 'false');
201210
}
202211

203212
protected function getDomainByRouteMatches($matches, $name)

0 commit comments

Comments
 (0)