- 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
36 lines
862 B
PHP
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);
|
|
}
|
|
}
|