Register the relations morph map
This commit is contained in:
@@ -14,6 +14,7 @@ namespace CachetHQ\Cachet\Foundation\Providers;
|
|||||||
use AltThree\Bus\Dispatcher;
|
use AltThree\Bus\Dispatcher;
|
||||||
use CachetHQ\Cachet\Bus\Middleware\UseDatabaseTransactions;
|
use CachetHQ\Cachet\Bus\Middleware\UseDatabaseTransactions;
|
||||||
use CachetHQ\Cachet\Services\Dates\DateFactory;
|
use CachetHQ\Cachet\Services\Dates\DateFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
@@ -42,6 +43,14 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
Str::macro('canonicalize', function ($url) {
|
Str::macro('canonicalize', function ($url) {
|
||||||
return preg_replace('/([^\/])$/', '$1/', $url);
|
return preg_replace('/([^\/])$/', '$1/', $url);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Relation::morphMap([
|
||||||
|
'components' => \CachetHQ\Cachet\Models\Component::class,
|
||||||
|
'incidents' => \CachetHQ\Cachet\Models\Incident::class,
|
||||||
|
'metrics' => \CachetHQ\Cachet\Models\Metric::class,
|
||||||
|
'schedules' => \CachetHQ\Cachet\Models\Schedule::class,
|
||||||
|
'subscriber' => \CachetHQ\Cachet\Models\Subscriber::class,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user