bag
bag copied to clipboard
fix: use __invoke to inject request classes on invokable controller
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.