lavary/laravel-menu — pull request #40 by ghprod (2014-12-03 06:21:49+00:00)
Title: Add ``depth`` to menu object, so we know where level we are.

Reference to lavary#28 (comment)

Sample code

```
@foreach($items as $item)

{{ $item->title }}
@if($item->hasChildren())

@include('admin::partials/custom-menu-items', array('items' => $item->children()))

@endif

@endforeach
```

``numToOrdinalWord`` is custom function to replace 1 to first, 2 to second, etc

```php
if ( ! function_exists('numToOrdinalWord')) {

function numToOrdinalWord($num)
{
$first_word =
array('eth','first','second','third','fouth','fifth','sixth','seventh','eighth','ninth','tenth','elevents','twelfth','thirteenth','fourteenth','fifteenth','sixteenth','seventeenth','eighteenth','nineteenth','twentieth');
$second_word = array('','','twenty','thirty','forty','fifty');

if ($num <= 20)
return $first_word[$num];

$first_num = substr($num,-1,1);
$second_num = substr($num,-2,1);

return str_replace('y-eth','ieth',$second_word[$second_num].'-'.$first_word[$first_num]);
}

}
```