Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't autoload with class_exists #659

Merged
merged 3 commits into from
May 7, 2023
Merged

Conversation

manavo
Copy link
Contributor

@manavo manavo commented May 7, 2023

Due to legacy reasons, in my codebase I have all the models being in the root namespace, not in the \App\Models namespace.

When trying to run php artisan scribe:generate, it would immediately fail when trying to actually load my models (Cannot declare class Account, because the name is already in use, because of the autoloading of class_exists. Setting the autoload to false made everything work again.

For what it's worth, the parameter it's checking does use Model Binding, so it sounds like it shouldn't be doing this anyway? (UrlParamsNormalizer::getTypeHintedEloquentModels finds it)

But either way, thought I'd submit this fix!

@shalvah shalvah merged commit 0efa273 into knuckleswtf:master May 7, 2023
@manavo manavo deleted the patch-1 branch May 7, 2023 14:58
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