-
Notifications
You must be signed in to change notification settings - Fork 11.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[9.x] Improve getter for morphed model alias #43487
[9.x] Improve getter for morphed model alias #43487
Conversation
Thanks for your pull request to Laravel! Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include. If possible, please consider releasing your code as a package so that the community can still take advantage of your contributions! If you feel absolutely certain that this code corrects a bug in the framework, please "@" mention me in a follow-up comment with further explanation so that GitHub will send me a notification of your response. |
Hi @taylorotwell, What do you think about just adding this method on public static function morphAlias()
{
return (new static)->getMorphClass();
} It's a small DX improvement. I also thought of changing the visibility of getMorphClass as protected, so that it could be called by |
Background, I uses polymorphic models heavily in apps, which at times requires to do something like
now, what if we updated the morph map from 'user' to 'other_user'?
Of couse we can imagine how many code we need to change.
Of course, suggestions are welcomed