Register the relations morph map

This commit is contained in:
James Brooks 2017-06-13 19:24:21 +01:00
parent 4b9e0141e8
commit 9cd5faaa6b

View File

@ -14,6 +14,7 @@ namespace CachetHQ\Cachet\Foundation\Providers;
use AltThree\Bus\Dispatcher;
use CachetHQ\Cachet\Bus\Middleware\UseDatabaseTransactions;
use CachetHQ\Cachet\Services\Dates\DateFactory;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
@ -42,6 +43,14 @@ class AppServiceProvider extends ServiceProvider
Str::macro('canonicalize', function ($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,
]);
}
/**