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

Model extending #1661

Merged
merged 145 commits into from
Aug 28, 2024
Merged

Model extending #1661

merged 145 commits into from
Aug 28, 2024

Conversation

alecritson
Copy link
Collaborator

This PR looks to build on the current work done for model extending and includes but not limited to the following changes:

  • Filament resources use the model contract for DI
  • Change to use Laravel's morphMap instead of having concrete classes in the database for polymorphic relationships
  • There was an issue with custom models when they extended Lunar ones, the newFactory method didn't like having the return type.
  • Added a addDir
  • Tweaked guessContractClass to take namespace into account as not all Lunar models (from addons) will have the same namespace
  • Added addDirectory method to prevent excessive calls to replace or add methods.
  • Updated relationships to use modelClass()
  • Static functions should forward to the custom class when called.
  • If a custom class name is different to the one it extends i.e. App\Models\MyProduct instead of App\Models\Product it will still use the correct table name.
  • Tweaked observe method on models that use HasModelExtending to forward to the custom class even if observe is called on the Lunar model.
  • Removed redundant tests and updated docs.

Set as draft for the moment as there is a fair amount of changes so just want to double check before hitting the button.

glennjacobs and others added 30 commits December 21, 2023 14:39
Co-authored-by: wychoong <67364036+wychoong@users.noreply.github.com>
# Conflicts:
#	packages/core/src/Models/Currency.php
@glennjacobs
Copy link
Contributor

@alecritson going to need to fix the conflicts before this can be merged.

@glennjacobs glennjacobs merged commit 3696422 into 1.x Aug 28, 2024
23 checks passed
@glennjacobs glennjacobs deleted the feat/model-extending-ar branch August 28, 2024 17:18
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.

6 participants