Skip to content

fix: use __invoke to inject request classes on invokable controller - #118

Merged
dshafik merged 2 commits into
beacon-hq:mainfrom
chuckadams:fix_invokable_controllers
Apr 22, 2026
Merged

dshafik merged 2 commits into
beacon-hq:mainfrom
chuckadams:fix_invokable_controllers

Conversation

@chuckadams

Copy link
Copy Markdown
Contributor

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.

@dshafik
dshafik merged commit 785dfee into beacon-hq:main Apr 22, 2026
34 of 36 checks passed
@dshafik

dshafik commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

Thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants