File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -180,6 +180,15 @@ protected function compileAction($action)
180
180
$ action = ['uses ' => $ action ];
181
181
}
182
182
183
+ if (is_array ($ action ) &&
184
+ is_callable ($ action ) &&
185
+ ! Arr::isAssoc ($ action )) {
186
+ $ action = [
187
+ 'uses ' => $ action [0 ].'@ ' .$ action [1 ],
188
+ 'controller ' => $ action [0 ].'@ ' .$ action [1 ],
189
+ ];
190
+ }
191
+
183
192
return array_merge ($ this ->attributes , $ action );
184
193
}
185
194
Original file line number Diff line number Diff line change @@ -140,6 +140,15 @@ public function testCanRegisterRouteWithControllerAction()
140
140
$ this ->seeMiddleware ('controller-middleware ' );
141
141
}
142
142
143
+ public function testCanRegisterRouteWithControllerActionArray ()
144
+ {
145
+ $ this ->router ->middleware ('controller-middleware ' )
146
+ ->get ('users ' , [RouteRegistrarControllerStub::class, 'index ' ]);
147
+
148
+ $ this ->seeResponse ('controller ' , Request::create ('users ' , 'GET ' ));
149
+ $ this ->seeMiddleware ('controller-middleware ' );
150
+ }
151
+
143
152
public function testCanRegisterRouteWithArrayAndControllerAction ()
144
153
{
145
154
$ this ->router ->middleware ('controller-middleware ' )->put ('users ' , [
You can’t perform that action at this time.
0 commit comments