Files
usher-manage-stack/app/Providers/AppServiceProvider.php
gbanyan 2e9b17e902 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
2026-02-13 12:05:38 +08:00

36 lines
862 B
PHP

<?php
namespace App\Providers;
use App\Models\Document;
use App\Models\Member;
use App\Observers\DocumentObserver;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
// Register morph map for custom polymorphic models
// 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,
]);
Document::observe(DocumentObserver::class);
}
}