{{--
--}} {{-- --}}
Navigation
@php // $currentUrl = (Request::path() != '/') ? '/'. Request::path() : '/'; // function renderSubMenu($value, $currentUrl) { // $subMenu = ''; // $GLOBALS['sub_level'] += 1 ; // $GLOBALS['active'][$GLOBALS['sub_level']] = ''; // $currentLevel = $GLOBALS['sub_level']; // foreach ($value as $key => $menu) { // $GLOBALS['subparent_level'] = ''; // $subSubMenu = ''; // $hasSub = (!empty($menu['sub_menu'])) ? 'has-sub' : ''; // $hasCaret = (!empty($menu['sub_menu'])) ? '
' : ''; // $hasHighlight = (!empty($menu['highlight'])) ? '
' : ''; // $hasTitle = (!empty($menu['title'])) ? '
'. $menu['title'] . $hasHighlight .'
' : ''; // if (!empty($menu['sub_menu'])) { // $subSubMenu .= '
'; // $subSubMenu .= renderSubMenu($menu['sub_menu'], $currentUrl); // $subSubMenu .= '
'; // } // $active = (!empty($menu['route-name']) && (Route::currentRouteName() == $menu['route-name'])) ? 'active' : ''; // if ($active) { // $GLOBALS['parent_active'] = true; // $GLOBALS['active'][$GLOBALS['sub_level'] - 1] = true; // } // if (!empty($GLOBALS['active'][$currentLevel])) { // $active = 'active'; // } // $subMenu .= ' //
//
' . $hasTitle . $hasCaret .'
// '. $subSubMenu .' //
// '; // } // return $subMenu; // } //echo $currentUser; // $currentUser11=auth()->user()->id; // $currentUserProfileId=auth()->user()->user_profile_id; $join=''; $result= \DB::table('master_menu_level_1 as a')->where('a.display','=','Y')->orderBY('a.sorting_order','asc')->select('a.id','a.menu_name','a.menu_link','a.sorting_order','a.display','a.icon')->orderBy('a.id', 'asc')->distinct()->get(); // $result= \DB::table('master_menu_level_1 as a')->join('user_wise_menu_permission as b', function ($join){ $join->on('a.id', '=', 'b.menu1_id');})->where('b.user_id','=', $currentUserProfileId)->where('a.display','=','Y')->where('b.permission','=','A')->whereNull('b.active_till')->orderBY('a.sorting_order','asc')->select('a.id','a.menu_name','a.menu_link','a.sorting_order','a.display','a.icon')->orderBy('a.id', 'asc')->distinct()->get(); $currentUserProfileId=5957; $sql=\DB::select(DB::raw( "SELECT user_id as user_profile_id, concat('t_4_',menu4_id) as menuid,menu1_id, menu2_id, menu3_id, menu4_id FROM user_wise_menu_permission where menu4_id!=0 AND active_till IS null and user_id = 5957 union SELECT user_id as user_profile_id, concat('t_3_',menu3_id) as menuid,menu1_id, menu2_id, menu3_id, menu4_id FROM user_wise_menu_permission where menu3_id!=0 and menu4_id=0 AND active_till IS null and user_id = 5957 union SELECT user_id as user_profile_id, concat('t_2_',menu2_id) as menuid,menu1_id, menu2_id, menu3_id, menu4_id FROM user_wise_menu_permission where menu2_id!=0 and menu3_id=0 and menu4_id=0 AND active_till IS null and user_id = 5957 union SELECT user_id as user_profile_id, concat('t_1_',menu1_id) as menuid,menu1_id, menu2_id, menu3_id, menu4_id FROM user_wise_menu_permission where menu1_id!=0 and menu2_id=0 and menu3_id=0 and menu4_id=0 AND active_till IS null and user_id = 5957 union select d.user_profile_id,t.menuid,t.menu1_id, t.menu2_id, t.menu3_id, t.menu4_id from users d inner join user_roles a on d.id = a.user_id inner join hrms_post_assigned c on c.user_id = d.user_profile_id and c.display = 'Y' and c.releaving_date is null inner join role_wise_menu_permission b on b.role_id = a.role_id and b.post_id = c.post_code and b.section_id = sec_code and b.active_till is null and a.active_till is null inner join ( select role_id, post_id, section_id, concat('t_4_', menu4_id) as menuid, menu1_id, menu2_id, menu3_id, menu4_id from role_wise_menu_permission where menu4_id != 0 union select role_id, post_id, section_id, concat('t_3_', menu3_id) as menuid, menu1_id, menu2_id, menu3_id, 0 menu4_id from role_wise_menu_permission where menu3_id != 0 and menu4_id = 0 union select role_id, post_id, section_id, concat('t_2_', menu2_id) as menuid, menu1_id, menu2_id, 0 menu3_id, 0 menu4_id from role_wise_menu_permission where menu2_id != 0 and menu3_id = 0 and menu4_id = 0 union select role_id, post_id, section_id, concat('t_1_', menu1_id) as menuid, menu1_id, 0 menu2_id, 0 menu3_id, 0 menu4_id from role_wise_menu_permission where menu1_id != 0 and menu2_id = 0 and menu3_id = 0 and menu4_id = 0 ) t on t.role_id = b.role_id and t.post_id = b.post_id and t.section_id = b.section_id and t.menu1_id=b.menu1_id and t.menu2_id=b.menu2_id and t.menu3_id=b.menu3_id and t.menu4_id=b.menu4_id left join revoked_menu_permission rp on rp.user_id=d.user_profile_id and rp.active_till is null and rp.menu1_id= b.menu1_id and rp.menu2_id= b.menu2_id and rp.menu3_id= b.menu3_id and rp.menu4_id= b.menu4_id where d.user_profile_id = 5957 and rp.id is null" )); // var_dump($sql); // echo '
'; $uniqueids_1 = array_unique(array_map(function ($i) { return $i->menu1_id; }, $sql)); var_dump($uniqueids_1); $result= \DB::table('master_menu_level_1 as a')->where('a.display','=','Y')->orderBY('a.sorting_order','asc')->select('a.id','a.menu_name','a.menu_link','a.sorting_order','a.display','a.icon')->whereIn('a.id', $uniqueids_1)->orderBy('a.id', 'asc')->distinct()->get(); $menuNew =[]; foreach($result as $value){ $filterBy = $value->id; $uniqueids_2_temp = collect($sql)->where('menu1_id', $filterBy)->all(); $uniqueids_2 = array_unique(array_map(function ($i) { return $i->menu2_id; }, $uniqueids_2_temp)); $result1= \DB::table('master_menu_level_2 as b')->where('b.display','=','Y')->where('b.menu_level_1_id','=',$value->id)->whereIn('b.id', $uniqueids_2)->orderBY('b.sorting_order','asc')->select('b.id','b.menu_name','b.menu_link','b.sorting_order','b.display','b.icon','b.menu_level_1_id')->orderBy('b.id', 'asc')->distinct()->get(); $menu1=[]; foreach($result1 as $value1){ $filterBy1 = $value1->id; $uniqueids_3_temp = collect($sql)->where('menu1_id', $filterBy)->where('menu2_id', $filterBy1)->all(); $uniqueids_3 = array_unique(array_map(function ($i) { return $i->menu3_id; }, $uniqueids_3_temp)); $result2= \DB::table('master_menu_level_3 as b')->where('b.display','=','Y')->where('b.menu_level_1_id','=',$value->id)->where('b.menu_level_2_id','=',$value1->id)->whereIn('b.id', $uniqueids_3)->orderBY('b.sorting_order','asc')->select('b.id','b.menu_name','b.menu_link','b.sorting_order','b.display','b.icon','b.menu_level_1_id','b.menu_level_2_id')->orderBy('b.id', 'asc')->distinct()->get(); $menu2=[]; foreach($result2 as $value2){ $tmenu2=['icon' => ($value2->icon!='' ? $value2->icon : 'fa fa-sitemap'), 'title' => $value2->menu_name, 'url' => ($value2->menu_link!='' ? $value2->menu_link : 'javascript:;') ]; array_push($menu2,$tmenu2); } $tmenu1=['icon' => ($value1->icon!='' ? $value1->icon : 'fa fa-sitemap'), 'title' => $value1->menu_name, 'url' => ($value1->menu_link!='' ? $value1->menu_link : 'javascript:;'), 'caret' => (count($menu2)>0 ? true : false), 'sub_menu' => $menu2 ]; array_push($menu1,$tmenu1); } $tmenu=['icon' => ($value->icon!='' ? $value->icon : 'fa fa-sitemap'), 'title' => $value->menu_name, 'url' => ($value->menu_link!='' ? $value->menu_link : 'javascript:;'), 'caret' => (count($menu1)>0 ? true : false), 'sub_menu' => $menu1 ]; array_push($menuNew,$tmenu); } var_dump($menuNew); //foreach (config('sidebar.menu') as $key => $menu) { // foreach ($menuNew as $key => $menu) { // $GLOBALS['parent_active'] = ''; // $hasSub = (!empty($menu['sub_menu'])) ? 'has-sub' : ''; // $hasCaret = (!empty($menu['caret'])) ? '
' : ''; // $hasIcon = (!empty($menu['icon'])) ? '
' : ''; // $hasImg = (!empty($menu['img'])) ? '
' : ''; // $hasLabel = (!empty($menu['label'])) ? '
'. $menu['label'] .'
' : ''; // $hasTitle = (!empty($menu['title'])) ? '
'. $menu['title'] . $hasLabel .'
' : ''; // $hasBadge = (!empty($menu['badge'])) ? '
'. $menu['badge'] .'
' : ''; // $subMenu = ''; // if (!empty($menu['sub_menu'])) { // $GLOBALS['sub_level'] = 0; // $subMenu .= '
'; // $subMenu .= renderSubMenu($menu['sub_menu'], $currentUrl); // $subMenu .= '
'; // } // $active = (!empty($menu['route-name']) && (Route::currentRouteName() == $menu['route-name'])) ? 'active' : ''; // $active = (empty($active) && !empty($GLOBALS['parent_active'])) ? 'active' : $active; // echo ' //
//
// '. $hasImg .' // '. $hasIcon .' // '. $hasTitle .' // '. $hasBadge .' // '. $hasCaret .' //
// '. $subMenu .' //
// '; // } @endphp {{--
--}}
{{--
--}}