Skip to content

Commit a331c2e

Browse files
committed
refactor
1 parent 24113f4 commit a331c2e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Illuminate/Routing/Router.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -992,9 +992,13 @@ protected function getClassClosure($controller)
992992
// Now we can split the controller and method out of the action string so that we
993993
// can call them appropriately on the class. This controller and method are in
994994
// in the Class@method format and we need to explode them out then use them.
995-
$classAndMethod = explode('@', $controller);
995+
$controller = explode('@', $controller);
996+
$class = $controller[0];
996997

997-
return $d->dispatch($route, $request, $classAndMethod[0], $classAndMethod[1] ?? '__invoke');
998+
// if route action doesn't define method, then by default use `__invoke` method, thus invokable action
999+
$method = $controller[1] ?? '__invoke';
1000+
1001+
return $d->dispatch($route, $request, $class, $method);
9981002
};
9991003
}
10001004

0 commit comments

Comments
 (0)