[5.6] Allow callable array syntax in route definition#24385
[5.6] Allow callable array syntax in route definition#24385taylorotwell merged 3 commits intolaravel:5.6from hulkur:router-array-callable
Conversation
|
what is the better navigation, that you can click through to the controller? |
|
yes, navigating to correct controller from string is bothersome |
|
Can't you just do that already manually, with about the same number of characters?
|
|
i guess you can, but in php array is one of the callable syntaxes so I added that |
|
Nice addition. I've hacked this in for years. |
|
It should works with code like |
|
It does not currently. |
|
Can you implement that? Seems that it could be done on line 47. It will make me very happy, once that I commonly use with |
|
I think there are two problems with this implementation:
I think these problems as well as lack of support of |
|
I would just add that you can not do : Route::get('/hello-world/{userId}', [
'as' => 'call_hello_world_please',
'uses' => [ Hello::class, 'world' ],
]);So you need to fallback to the string syntax ... 💀 |
|
This was rejected in #24589 |
This PR will allow defining route actions as arrays
Route::get('smth', [SomeController::class, 'methodName']);This has no direct benefit code-wise, but enables better navigation in IDE-s.
is_callablevalidates that specified class and method exist and onlyis_arraycheck is needed.