-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix issue where \Eloquent is not included when using write_mixin #1352
Conversation
Will this end up writing |
It will put it in the generated To temporarily work around the issue while this isn't merged you can delete the docblock written to your main models that contains the |
For the temporary work around, do you mean delete the |
Yes. In the current version any mixins existing on the original model will cause |
Wow - so this also doesn't add it when you add a brand new model (it'll add the mixin to the model but not to the generated class). Certainly frustrating. Thanks for this PR! |
@barryvdh any plans to merge this pull request? |
…ryvdh#1352) * Check for exact mixin name when writing * changelog * add mixin to test class Co-authored-by: Barry vd. Heuvel <[email protected]>
…ryvdh#1352) * Check for exact mixin name when writing * changelog * add mixin to test class Co-authored-by: Barry vd. Heuvel <[email protected]>
Summary
If you write your models using the
--write-mixin
option the included docblock generated on the model will include a mixin. Previously the code replaced here would ignore the@mixin \Eloquent
addition if any mixin existed on the model. This would break the code suggestions as on first write the Eloquent mixin would be added but after that it wouldn't be generated as its detected as 'already existing'. Info including the lines and commits where I found this are discussed in #1299This fix changes it to a loop which removes any mixins that matches the Eloquent class before appending it.
Also fixes #1342, fixes #1343, fixes #1299
Type of change
Checklist
composer fix-style