php - How do Recursive menu in laravel 5? -
i have passed value on variable controller view page, , show value in foreach
loop. want do, when execute foreach
loop, value want pass in "test" controller method.. have query defendant on value.
a) there way of getting response of controller within view
b) there way of getting response of controller within controller method, can push result view? code far is:
first action on method : (accheadcontroller/create)
public function create() { $root = db::table('chart_of_account') ->select('*') ->where('parent_id','=',0) ->get(); return view('pages.createacchead')->with('level1', $root); }
and pass level1 variable on view page (pages.createacchead) :
<fieldset> @foreach($level1 $item) <ul> <li> <input type="radio" name="acchead" value="{{$item->id}}"> {{$item->title}}</br> </li> </ul> @endforeach </fieldset>
how pass $item->id accheadcontroller test methode when execute foreach?
and here accheadcontroller/test method :
public function test($id){ $root = db::table('chart_of_account') ->select('*') ->where('parent_id','=',$id) ->get(); }
actually want show unlimited sub menu.
Comments
Post a Comment