mardi 1 septembre 2015

How to get submenu links in sidebar

Iam in confusion to solve this problem. I have a database table named site_pageswith column name id, page_title,page_alias,page_parent, timestamps

I have a menu"About us" havingparent id 1(ie page_parent is 1 ),which have submenu like establishment,management,BODetc

likewise i have a "Our Products"menu having parent id 2(iepage_parent is 2),which have submenulike duty insurance,vehicle insurance etc

simillary , i have a "Our clients"menu having parent id 3(ie page_parent is 3),which have submenu like Banks,Hotels etc

Now when user visit the About us page it should dispaly all submenulike establishment,management,BODofAbout us menu on sidebar simillary forOur clients and Our products should also display their own submenu on sidebar when user click their parent menu. All of these are on same page

Route:

Route::get('/{slug}','FrontendController@page);

Controller is like this

public function page($slug)
{
$sidebarAbout = DB::table('site_pages')->select('page_alias','page_title','page_parent')->where('page_parent','1')->where('page_status','1')->get();

  $sidebarProducts = DB::table('site_pages')->select('page_alias','page_title','page_parent')->where('page_parent','2')->where('page_status','1')->get();
}

Current view is like this //This view display on every menu but this should display only on About us and for Our Products Menu another siderbar of Our products should be displayed

@if(isset($sidebarAbout))
   @foreach($sidebarAbout as $sider)
 <ul>
     <li><a href="{{$sider->page_alias}}">{{$sider->page_title}}</a></li>
@endforeach
    @endif

Now i should know what is current parent menu is clicked so that in view i can show their submenu with their links I need help



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1O6Jx4D
via IFTTT

Aucun commentaire:

Enregistrer un commentaire