bag icon indicating copy to clipboard operation
bag copied to clipboard

fix: use __invoke to inject request classes on invokable controller

Open chuckadams opened this issue 2 months ago • 0 comments

When using a single-action controller with an __invoke method, $route->getActionMethod() will return the name of the controller instead of any usable method, so we end up getting baffling errors about methods like App\Http\Controllers\My\Controller::App\Http\Controllers\My\Controller() not existing. Arguably this is a bug in Laravel, but we have to work around it, so this detects if the method is identical to the controller, and switches it to __invoke if so.

chuckadams avatar Oct 26 '25 03:10 chuckadams