Model extending
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
morphMapinstead of having concrete classes in the database for polymorphic relationships - There was an issue with custom models when they extended Lunar ones, the
newFactorymethod didn't like having the return type. - Added a
addDir - Tweaked
guessContractClassto take namespace into account as not all Lunar models (from addons) will have the same namespace - Added
addDirectorymethod to prevent excessive calls toreplaceoraddmethods. - 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\MyProductinstead ofApp\Models\Productit will still use the correct table name. - Tweaked
observemethod on models that useHasModelExtendingto 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.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| lunar-docs | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Aug 28, 2024 5:12pm |
@alecritson I've updated the parent branch and we can now see we have some conflicts. And we know we probably need to update Brands from your other PR that was merged.
@alecritson I've updated the parent branch and we can now see we have some conflicts. And we know we probably need to update Brands from your other PR that was merged.
The conflicts should all be sorted 🤞
InstallLunar class should be also updated right? It currently uses 'attributable_type' => Product::class, and instead it should pick the morphed name.
Kudos for all the work <3. But eta for this? Looks like the most needed and essential feature of v1
Kudos for all the work <3. But eta for this? Looks like the most needed and essential feature of v1
It'd essentially ready and on a PR. We are just trying to get some more PRs merged before that one goes in.
Oeh we need this one
@alecritson going to need to fix the conflicts before this can be merged.