动态菜单和链接

时间:2017-05-26 12:30:20

标签: laravel laravel-5.4

我有导航:

Cars->Car 1->Menu

Car 1是动态值。我选择了Car X,我得到了Car X的菜单。怎么做?

我的意思是,在选择Car X时,在链接中添加了值Car=x

cars->car_id->maintenances->index
cars->car_id->maintenances->maintenance_id->edit
cars->car_id->repairs->index
cars->car_id->repairs->repair_id->edit

请帮忙。抱歉我的英文。

1 个答案:

答案 0 :(得分:0)

我不知道你的牌桌,但我想你可以这样做:

<ul>
@foreach($cars as $car)
  <li>
    <a href="{!! action('MeintenancesController@index', $car->id)!!}">{!! $car->name!!}</a>
    <ul class="submenu">
    @foreach($car->meintenances as $meintenance)
      <li>
        <a href="{!! action('MeintenancesController@edit, $meintenance->id) !!}">{!!$meintenance->name!!}</a>
      </li>
    @endforeach
    </ul>
  </li>
@enforeach
</ul>

维修相同