Skip to content

Commit bcdd02b

Browse files
committed
Add array route support
1 parent 512eb1a commit bcdd02b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Routing/Router.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,11 @@ public function addRoute($methods, $uri, $action)
337337
$action = ['uses' => $action, 'controller' => $action];
338338
} elseif ($action instanceof Closure) {
339339
$action = [$action];
340+
} elseif (is_array($action)) {
341+
if (is_string(Arr::first($action)) && class_exists(Arr::first($action)) && sizeof($action) == 2) {
342+
$action = implode("@", $action);
343+
$action = ['uses' => $action, 'controller' => $action];
344+
}
340345
}
341346

342347
$action = $this->mergeLastGroupAttributes($action);

0 commit comments

Comments
 (0)