src/Webpage/Traits/HasParent.php
public function scopeWhereFullPath(Builder $query, string $path)
    {
        $itemSlugs = explode('/', $path);

        return $query->where('slug', '=', end($itemSlugs))
            ->get()
            ->filter(function ($item) use ($path) {
                return $item->full_path === str_start($path, '/');
            });
    }
public function scopeWhereFullPath(Builder $query, string $path)
    {
        $itemSlugs = explode('/', $path);

        return $query->where('slug', '=', end($itemSlugs))
            ->get()
            ->filter(function ($item) use ($path) {
                return $item->full_path === str_start($path, '/');
            });
    }
public function scopeWhereFullPath ( Builder $ query , string $ path ) { $ itemSlugs = explode ( '/' , $ path ) ; return $ query -> where ( 'slug' , '=' , end ( $ itemSlugs ) ) -> get ( ) -> filter ( function ( $ item ) use ( $ path ) { return $ item -> full_path === str_start ( $ path , '/' ) ; } ) ; }
Scope the query to only items that match the full path.

@param \Illuminate\Database\Eloquent\Builder $query
@param string $path Full path
@return \Illuminate\Database\Eloquent\Builder
Scope the query to only items that match the full path .