If given a single action controller of closure, the previous code would
unceremoniously crash with an "Undefined offset: 1" error (see Issue #8).
This handles the $currentRouteAction differently in that:
If we can split it by @ we do and it will behave as before;
If we cannot, we'll check if $currentRouteAction is a string and if, and only if it is, we'll set the $controller to empty and the current action as the value of $currentAction - this is not necessarily ideal but it is better than crashing;
If it's something else entirely we will use json_encode and set the current action to be that value.
We could probably tell if $currentAction is a closure and/or a single action controller BUT the main goal of this commit is to stop crashing.
[OOPS - Removed important code]
If given a single action controller of closure, the previous code would unceremoniously crash with an "Undefined offset: 1" error (see Issue #8).
This handles the
$currentRouteAction
differently in that:@
we do and it will behave as before;$currentRouteAction
is a string and if, and only if it is, we'll set the$controller
to empty and the current action as the value of$currentAction
- this is not necessarily ideal but it is better than crashing;json_encode
and set the current action to be that value.We could probably tell if
$currentAction
is a closure and/or a single action controller BUT the main goal of this commit is to stop crashing.I have tested it on Laravel 6.X.