Skip to content

Commit 33f3612

Browse files
committed
Restore enforceMorphMap
1 parent 2d8ee8f commit 33f3612

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/OzuServiceProvider.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Code16\OzuClient\View\Components\Content;
1212
use Code16\OzuClient\View\Components\File;
1313
use Code16\OzuClient\View\Components\Image;
14+
use Illuminate\Database\Eloquent\Relations\Relation;
1415
use Illuminate\Pagination\LengthAwarePaginator;
1516
use Illuminate\Pagination\Paginator;
1617
use Illuminate\Support\Facades\Blade;
@@ -74,12 +75,13 @@ public function boot()
7475
return request()->route()->parameter('page');
7576
});
7677

77-
// Relation::enforceMorphMap(
78-
// collect(config('ozu-client.collections'))
79-
// ->mapWithKeys(fn ($className) => [
80-
// (new $className)->ozuCollectionKey() => $className
81-
// ])
82-
// ->toArray()
83-
// );
78+
// Use Ozu's collectionKey as the morphMap key
79+
Relation::enforceMorphMap(
80+
collect(config('ozu-client.collections'))
81+
->mapWithKeys(fn (string $className) => [
82+
(new $className)->ozuCollectionKey() => $className
83+
])
84+
->toArray()
85+
);
8486
}
8587
}

0 commit comments

Comments
 (0)