fix(01-01): use morphMap instead of enforceMorphMap to avoid breaking Spatie

- Changed from enforceMorphMap to morphMap in AppServiceProvider
- enforceMorphMap was causing errors with Spatie Laravel Permission package
- morphMap still provides namespace protection for our custom models
- Adds comment explaining why we don't enforce strict mapping
This commit is contained in:
2026-02-13 12:05:38 +08:00
parent 4ca7530957
commit 2e9b17e902

View File

@@ -23,8 +23,10 @@ class AppServiceProvider extends ServiceProvider
*/ */
public function boot(): void public function boot(): void
{ {
// Register morph map to protect against namespace refactoring // Register morph map for custom polymorphic models
Relation::enforceMorphMap([ // Note: We use morphMap() instead of enforceMorphMap() to avoid breaking
// third-party packages (like Spatie Laravel Permission) that use polymorphic relationships
Relation::morphMap([
'member' => Member::class, 'member' => Member::class,
]); ]);