Skip to content

Commit 20b257f

Browse files
Allow RouteRegistrar to be Macroable (#56921)
1 parent aa1ee57 commit 20b257f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Illuminate/Routing/RouteRegistrar.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Closure;
88
use Illuminate\Support\Arr;
99
use Illuminate\Support\Reflector;
10+
use Illuminate\Support\Traits\Macroable;
1011
use InvalidArgumentException;
1112

1213
/**
@@ -34,6 +35,9 @@
3435
class RouteRegistrar
3536
{
3637
use CreatesRegularExpressionRouteConstraints;
38+
use Macroable {
39+
__call as macroCall;
40+
}
3741

3842
/**
3943
* The router instance.
@@ -280,6 +284,10 @@ protected function compileAction($action)
280284
*/
281285
public function __call($method, $parameters)
282286
{
287+
if (static::hasMacro($method)) {
288+
return $this->macroCall($method, $parameters);
289+
}
290+
283291
if (in_array($method, $this->passthru)) {
284292
return $this->registerRoute($method, ...$parameters);
285293
}

0 commit comments

Comments
 (0)