atayahmet / laravel-nestable

Laravel 5 nested category/menu generator
MIT License
214 stars 52 forks source link

Generating deep url for sub categories #13

Closed aghayeff closed 7 years ago

aghayeff commented 7 years ago

Well, lets look through this example:

<ul>
    <li><a href="">T-shirts
        <ul>
            <li><a href="red-t-shirt">Red T-shirt</a>
                <ul>
                     <li><a href="s-size">S size</a><li>
                     <li><a href="m-size">M size</a><li>
                     <li><a href="l-size">L size</a><li>
                </ul>
            </li>
        </ul>
    </li>
</ul>

Is it possible to generate deep url for sub categories?

Instead of <li><a href="s-size">S size</a><li>

generate <li><a href="red-t-shirt/s-size">S size</a><li>

atayahmet commented 7 years ago

Hi @aghayeff

I added new feature via your suggestion. Now passed parent element to closure function. If has not parent element of current elements is passed null, Please update package.

Example:

<?php

Menu::route(function($href, $label, $parent) {

    return \URL::to($href);

})->renderAsHtml();
aghayeff commented 7 years ago

Thanks! I appreciate