https://twill.io logo
Route::name('page')->get('/{slug}', [PageControlle...
# ❓questions
e
Route::name('page')->get('/{slug}', [PageController::class, 'index'])->where('slug', '.*');
i
Copy code
php
public function forNestedSlug($nestedSlug, $with = [], $withCount = [], $scopes = [])
{
    $targetSlug = collect(explode('/', $nestedSlug))->last();

    $targetItem = $this->forSlug($targetSlug, $with, $withCount, $scopes);

    if (!$targetItem || $nestedSlug !== $targetItem->nestedSlug) {
        return null;
    }

    return $targetItem;
}
this is the implementation of forNestedSLug
as you can see it takes $nestedSlug, split it by / and takes the last part. then it checks if the found item is actually correct
e
No, it works correctly if I echo it on page level
I added a general navigation to my provider with a browser which loads the pages, this all works perfectly, but if I loop through the items, I don't think my item is connected to my repository so I miss this part: $page = app(PageRepository::class)->forNestedSlug($slug); And therefor it does not know it is a child..