route()->getController() is completely unsafe to use if the route uses a closure, and route()->isControllerAction() is protected. This leads to errors like BindingResolutionException: Target class [] does not exist. if a tool uses closures instead of controllers as they are turned into serialized closures. Therefore, the following code does not handle the cases correctly:
route()->getController()
is completely unsafe to use if the route uses a closure, and route()->isControllerAction() is protected. This leads to errors likeBindingResolutionException: Target class [] does not exist.
if a tool uses closures instead of controllers as they are turned into serialized closures. Therefore, the following code does not handle the cases correctly:The function
getControllerClass()
is protected by the following function (inIlluminate\Routing\Route
):I have rewritten the two occurrences of
route()->getController()
to usegetControllerClass()
instead.Reference: https://github.com/wdelfuego/nova-calendar/issues/41#issuecomment-1326471351