-
Notifications
You must be signed in to change notification settings - Fork 288
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
Model extending #1661
base: 1.x
Are you sure you want to change the base?
Model extending #1661
Conversation
InstallLunar class should be also updated right? It currently uses |
@@ -175,6 +175,8 @@ public function register(): void | |||
$this->app->singleton(DiscountManagerInterface::class, function ($app) { | |||
return $app->make(DiscountManager::class); | |||
}); | |||
|
|||
\Lunar\Facades\ModelManifest::register(); // Facade is the same name as the class, change?? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we need to address the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed the comment, not sure what needs changing as it's a common pattern in Laravel?
This PR looks to build on the current work done for model extending and includes but not limited to the following changes:
morphMap
instead of having concrete classes in the database for polymorphic relationshipsnewFactory
method didn't like having the return type.addDir
guessContractClass
to take namespace into account as not all Lunar models (from addons) will have the same namespaceaddDirectory
method to prevent excessive calls toreplace
oradd
methods.modelClass()
App\Models\MyProduct
instead ofApp\Models\Product
it will still use the correct table name.observe
method on models that useHasModelExtending
to forward to the custom class even if observe is called on the Lunar model.Set as draft for the moment as there is a fair amount of changes so just want to double check before hitting the button.