jeroennoten / Laravel-AdminLTE

Easy AdminLTE integration with Laravel
MIT License
3.84k stars 1.09k forks source link

Menu Issue #798

Closed Sourajit-Maity closed 3 years ago

Sourajit-Maity commented 3 years ago
Thanks for this awesome theme.. I have use this for my project.. Please suggest me how do I make a role based menu item in this adminlte.php file.. If condition is not working there Answer
Issue or Enhancement Issue Enhancement
Laravel Version 8 Used version of Laravel
Project Version Used version of this project

Current Behavior

Expected Behavior

Steps to Reproduce

Possible Solutions

resslinger commented 3 years ago

Please provide us code to reproduce it.

dfsmania commented 3 years ago

I'm not really sure what are your goals with so little explanation, but you can start by reading about:

Sourajit-Maity commented 3 years ago

Actually I want role based menu view like admin can access all the menus but for employee and person can not access all the menu item they can only access specific menu item..how can i build this in this theme..I will share my adminlte.php file where all the menu item is located.

<?php

return [

/*
|--------------------------------------------------------------------------
| Title
|--------------------------------------------------------------------------
|
| Here you can change the default title of your admin panel.
|
| For detailed instructions you can look the title section here:
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/6.-Basic-Configuration
|
*/

'title' => 'Royal',
'title_prefix' => '',
'title_postfix' => '',

/*
|--------------------------------------------------------------------------
| Favicon
|--------------------------------------------------------------------------
|
| Here you can activate the favicon.
|
| For detailed instructions you can look the favicon section here:
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/6.-Basic-Configuration
|
*/

'use_ico_only' => false,
'use_full_favicon' => false,

/*
|--------------------------------------------------------------------------
| Logo
|--------------------------------------------------------------------------
|
| Here you can change the logo of your admin panel.
|
| For detailed instructions you can look the logo section here:
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/6.-Basic-Configuration
|
*/

'logo' => '<b><i>Royal</i></b>',
'logo_img' => 'vendor/adminlte/dist/img/RR-logo.png',
'logo_img_class' => 'brand-image img-circle elevation-3',
'logo_img_xl' => null,
'logo_img_xl_class' => 'brand-image-xs',
'logo_img_alt' => 'Royal',

/*
|--------------------------------------------------------------------------
| User Menu
|--------------------------------------------------------------------------
|
| Here you can activate and change the user menu.
|
| For detailed instructions you can look the user menu section here:
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/6.-Basic-Configuration
|
*/

'usermenu_enabled' => true,
'usermenu_header' => false,
'usermenu_header_class' => 'bg-primary',
'usermenu_image' => false,
'usermenu_desc' => false,
'usermenu_profile_url' => false,

/*
|--------------------------------------------------------------------------
| Layout
|--------------------------------------------------------------------------
|
| Here we change the layout of your admin panel.
|
| For detailed instructions you can look the layout section here:
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/7.-Layout-and-Styling-Configuration
|
*/

'layout_topnav' => null,
'layout_boxed' => null,
'layout_fixed_sidebar' => null,
'layout_fixed_navbar' => null,
'layout_fixed_footer' => true,

/*
|--------------------------------------------------------------------------
| Authentication Views Classes
|--------------------------------------------------------------------------
|
| Here you can change the look and behavior of the authentication views.
|
| For detailed instructions you can look the auth classes section here:
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/7.-Layout-and-Styling-Configuration
|
*/

'classes_auth_card' => 'card-outline card-primary',
'classes_auth_header' => '',
'classes_auth_body' => '',
'classes_auth_footer' => '',
'classes_auth_icon' => '',
'classes_auth_btn' => 'btn-flat btn-primary',

/*
|--------------------------------------------------------------------------
| Admin Panel Classes
|--------------------------------------------------------------------------
|
| Here you can change the look and behavior of the admin panel.
|
| For detailed instructions you can look the admin panel classes here:
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/7.-Layout-and-Styling-Configuration
|
*/

'classes_body' => '',
'classes_brand' => '',
'classes_brand_text' => '',
'classes_content_wrapper' => '',
'classes_content_header' => '',
'classes_content' => '',
'classes_sidebar' => 'sidebar-light-primary elevation-4',
'classes_sidebar_nav' => '',
'classes_topnav' => 'navbar-blue navbar-dark',
'classes_topnav_nav' => 'navbar-expand',
'classes_topnav_container' => 'container',

/*
|--------------------------------------------------------------------------
| Sidebar
|--------------------------------------------------------------------------
|
| Here we can modify the sidebar of the admin panel.
|
| For detailed instructions you can look the sidebar section here:
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/7.-Layout-and-Styling-Configuration
|
*/

'sidebar_mini' => true,
'sidebar_collapse' => false,
'sidebar_collapse_auto_size' => false,
'sidebar_collapse_remember' => false,
'sidebar_collapse_remember_no_transition' => true,
'sidebar_scrollbar_theme' => 'os-theme-light',
'sidebar_scrollbar_auto_hide' => 'l',
'sidebar_nav_accordion' => true,
'sidebar_nav_animation_speed' => 300,

/*
|--------------------------------------------------------------------------
| Control Sidebar (Right Sidebar)
|--------------------------------------------------------------------------
|
| Here we can modify the right sidebar aka control sidebar of the admin panel.
|
| For detailed instructions you can look the right sidebar section here:
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/7.-Layout-and-Styling-Configuration
|
*/

'right_sidebar' => false,
'right_sidebar_icon' => 'fas fa-cogs',
'right_sidebar_theme' => 'dark',
'right_sidebar_slide' => true,
'right_sidebar_push' => true,
'right_sidebar_scrollbar_theme' => 'os-theme-light',
'right_sidebar_scrollbar_auto_hide' => 'l',

/*
|--------------------------------------------------------------------------
| URLs
|--------------------------------------------------------------------------
|
| Here we can modify the url settings of the admin panel.
|
| For detailed instructions you can look the urls section here:
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/6.-Basic-Configuration
|
*/

'use_route_url' => false,
'dashboard_url' => 'home',
'logout_url' => 'logout',
'login_url' => 'login',
'register_url' => 'register',
'password_reset_url' => 'password/reset',
'password_email_url' => 'password/email',
'profile_url' => false,

/*
|--------------------------------------------------------------------------
| Laravel Mix
|--------------------------------------------------------------------------
|
| Here we can enable the Laravel Mix option for the admin panel.
|
| For detailed instructions you can look the laravel mix section here:
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/9.-Other-Configuration
|
*/

'enabled_laravel_mix' => false,
'laravel_mix_css_path' => 'css/app.css',
'laravel_mix_js_path' => 'js/app.js',

/*
|--------------------------------------------------------------------------
| Menu Items
|--------------------------------------------------------------------------
|
| Here we can modify the sidebar/top navigation of the admin panel.
|
| For detailed instructions you can look here:
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/8.-Menu-Configuration
|
*/

'menu' => [
    [
        'text' => 'search',
        'search' => false,
        'topnav' => false,
    ],
    [
        'text' => 'blog',
        'url'  => 'admin/blog',
        'can'  => 'manage-blog',
    ],

    // ['header' => 'account_settings'],
    [
        'text'    => 'Admin',
        'icon'    => 'fas fa-users-cog',
        'submenu' => 
        [
            [                
                'text'    => 'User Management',
                'icon'    => 'fas fa-users',
                'url'     => '#',
                'shift'   => 'ml-2',
                'submenu' => 
                [
                    [
                        'text' => 'User',
                        'icon'    => 'fas fa-user',
                        'url'  => 'view-user',
                        'shift'=> 'ml-3',

                    ],                        
                    [
                        'text' => 'User Roles',
                        'icon'    => 'fas fa-user-tag',
                        'url'  => 'view-role',
                        'shift'=> 'ml-3',

                    ],
                    [
                        'text' => 'User Role Categories',
                        'icon'    => 'far fa-user-circle',
                        'url'  => 'view-sub-role',
                        'shift'=> 'ml-3',

                    ],                        

                ],                    

            ],

            [                
                'text'    => 'Job',
                'icon'    => 'fas fa-user-md',
                'url'     => '#',
                'shift'   => 'ml-2',
                'submenu' => 
                [
                    [
                        'text' => 'Job Titles',
                        'icon'    => 'fas fa-user-md',
                        'url'  => '#',
                        'shift'=> 'ml-3',

                    ],                        
                    [
                        'text' => 'Pay Grade',
                        'icon'    => 'fas fa-user-md',
                        'url'  => '#',
                        'shift'=> 'ml-3',

                    ],
                    [
                        'text' => 'Employment Status',
                        'icon'    => 'fas fa-user-md',
                        'url'  => '#',
                        'shift'=> 'ml-3',

                    ],                  
                    [
                        'text' => 'Job Categories',
                        'icon'    => 'fas fa-user-md',
                        'url'  => '#',
                        'shift'=> 'ml-3',

                    ], 
                    [
                        'text' => 'Work Shifts',
                        'icon'    => 'fas fa-business-time',
                        'url'  => 'view-workshift',
                        'shift'=> 'ml-3',

                    ], 
                ],                    

            ],
            [                
                'text'    => 'Company Master',
                'icon'    => 'fas fa-building',
                'url'     => 'view-company',
                'shift'   => 'ml-2',

            ],
            [
                'text' => 'Qualification',
                'icon'    => 'fas fa-user-graduate',
                'url'     => '#',
                'shift'   => 'ml-2',
                'submenu' => 
                [

                    [
                        'text' => 'Education',
                        'icon'    => 'fas fa-book-open',
                        'url'  => 'view-education',
                        'shift'=> 'ml-3',

                    ], 
                    [
                        'text' => 'Skills',
                        'icon'    => 'fas fa-award',
                        'url'  => 'view-skills',
                        'shift'=> 'ml-3',

                    ], 
                ],      
            ],
            [
                'text' => 'Defined Corporate Actions',
                'icon' => 'fas fa-level-down-alt',
                'url'     => '#',
                'shift'   => 'ml-2',
            ],
            [
                'text' => 'Religions',
                'icon'    => 'fas fa-praying-hands',
                'url'     => 'all-religion',
                'shift'   => 'ml-2',
            ],
            [
                'text' => 'Nationalities',
                'icon'    => 'fas fa-globe-asia',
                'url'     => 'all-nationality',
                'shift'   => 'ml-2',
            ],

        ],
    ],
    [
        'text' => 'PIM',
        'url'  => 'admin/settings',
        'icon' => 'fas fa-fw fa-lock',
        'submenu' => 

        [                
            [
                  'text' => 'Add Employee',
                  'icon'    => 'fas fa-user-plus',
                  'url'  => 'addemployeetab',
                  'shift'=> 'ml-2',

              ],                        
              [
                  'text' => 'Reports',
                  'icon' => 'fas fa-level-down-alt',
                  'url'  => '#',
                  'shift'=> 'ml-2',

              ],
              [
                  'text' => 'Configuration',
                  'icon' => 'fas fa-level-down-alt',
                  'url'  => '#',
                  'shift'=> 'ml-2',

              ],                  
              [
                  'text' => 'Employee List',
                  'icon'    => 'fas fa-street-view',
                  'url'  => 'view-employee',
                  'shift'=> 'ml-2',

              ],                                 

      ],
    ],
    [
        'text' => 'Leave',
        'url'  => 'admin/settings',
        'icon' => 'fas fa-level-down-alt',
        'submenu' => 

            [                
                [
                      'text' => 'Apply',
                      'icon' => 'fas fa-level-down-alt',
                      'url'  => '#',
                      'shift'=> 'ml-2',

                  ],                        
                  [
                      'text' => 'My leave',
                      'icon' => 'fas fa-level-down-alt',
                      'url'  => 'view-my-leave-entitlement',
                      'shift'=> 'ml-2',

                  ],
                  [
                      'text' => 'Configure',
                      'icon' => 'fas fa-level-down-alt',
                      'url'  => '#',
                      'shift'=> 'ml-2',
                      'submenu' => 
                      [
                          [
                              'text' => 'Leave Period',
                              'icon'    => 'fas fa-sign-out-alt',
                              'url'  => 'view-leave-period',
                              'shift'=> 'ml-3',

                          ],                        
                          [
                              'text' => 'Leave Type',
                              'icon'    => 'fas fa-sign-out-alt',
                              'url'  => 'view-leave-type',
                              'shift'=> 'ml-3',

                          ],
                          [
                              'text' => 'Work week',
                              'icon'    => 'fas fa-binoculars',
                              'url'  => 'view-work-week',
                              'shift'=> 'ml-3',

                          ], 
                          [
                            'text' => 'Holidays',
                            'icon'    => 'fas fa-binoculars',
                            'url'  => 'view-holiday',
                            'shift'=> 'ml-3',

                        ],                        

                      ],  

                  ],                  
                  [
                      'text' => 'Reports',
                      'icon' => 'fas fa-level-down-alt',
                      'url'  => '#',
                      'shift'=> 'ml-2',

                  ], 

                  [
                      'text' => 'Entitlements',
                      'icon'    => 'fas fa-binoculars',
                      'url'  => 'view-leave-entitlement',
                      'shift'=> 'ml-2',

                   ], 

                   [
                      'text' => 'Leave List',
                      'icon' => 'fas fa-level-down-alt',
                      'url'  => '#',
                      'shift'=> 'ml-2',

                  ], 
                  [
                      'text' => 'Assign Leave',
                      'icon' => 'fas fa-level-down-alt',
                      'url'  => '#',
                      'shift'=> 'ml-2',

                  ],                

          ],

    ],
    [
        'text' => 'Time',
        'url'  => 'admin/settings',
        'icon' => 'fas fa-business-time',

    ],
    [
        'text' => 'MyInfo',
        'url'  => '#',
        'icon' => 'fas fa-info-circle',

    ],

],

/*
|--------------------------------------------------------------------------
| Menu Filters
|--------------------------------------------------------------------------
|
| Here we can modify the menu filters of the admin panel.
|
| For detailed instructions you can look the menu filters section here:
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/8.-Menu-Configuration
|
*/

'filters' => [
    JeroenNoten\LaravelAdminLte\Menu\Filters\GateFilter::class,
    JeroenNoten\LaravelAdminLte\Menu\Filters\HrefFilter::class,
    JeroenNoten\LaravelAdminLte\Menu\Filters\SearchFilter::class,
    JeroenNoten\LaravelAdminLte\Menu\Filters\ActiveFilter::class,
    JeroenNoten\LaravelAdminLte\Menu\Filters\ClassesFilter::class,
    JeroenNoten\LaravelAdminLte\Menu\Filters\LangFilter::class,
    JeroenNoten\LaravelAdminLte\Menu\Filters\DataFilter::class,
],

/*
|--------------------------------------------------------------------------
| Plugins Initialization
|--------------------------------------------------------------------------
|
| Here we can modify the plugins used inside the admin panel.
|
| For detailed instructions you can look the plugins section here:
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/9.-Other-Configuration
|
*/

'plugins' => [
    'Datatables' => [
        'active' => false,
        'files' => [
            [
                'type' => 'js',
                'asset' => true,
                'location' => '//cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js',
            ],
            [
                'type' => 'js',
                'asset' => true,
                'location' => '//cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js',
            ],
            [
                'type' => 'css',
                'asset' => true,
                'location' => '//cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css',
            ],
        ],
    ],
    'Select2' => [
        'active' => true,
        'files' => [
            [
                'type' => 'js',
                'asset' => true,
                'location' => '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js',
            ],
            [
                'type' => 'css',
                'asset' => true,
                'location' => '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.css',
            ],
        ],
    ],
    'Chartjs' => [
        'active' => true,
        'files' => [
            [
                'type' => 'js',
                'asset' => true,
                'location' => '//cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.0/Chart.bundle.min.js',
            ],
        ],
    ],
    'Sweetalert2' => [
        'active' => false,
        'files' => [
            [
                'type' => 'js',
                'asset' => false,
                'location' => '//cdn.jsdelivr.net/npm/sweetalert2@8',
            ],
        ],
    ],
    'Pace' => [
        'active' => false,
        'files' => [
            [
                'type' => 'css',
                'asset' => false,
                'location' => '//cdnjs.cloudflare.com/ajax/libs/pace/1.0.2/themes/blue/pace-theme-center-radar.min.css',
            ],
            [
                'type' => 'js',
                'asset' => false,
                'location' => '//cdnjs.cloudflare.com/ajax/libs/pace/1.0.2/pace.min.js',
            ],
        ],
    ],
],

/*
|--------------------------------------------------------------------------
| Livewire
|--------------------------------------------------------------------------
|
| Here we can enable the Livewire support.
|
| For detailed instructions you can look the livewire here:
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/9.-Other-Configuration
*/

'livewire' => false,

];

REJack commented 3 years ago

@Sourajit-Maity Place your code in a code block, for better readability.

You can create fenced code blocks by placing triple backticks ``` before and after the code block. Source: https://docs.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks

dfsmania commented 3 years ago

@Sourajit-Maity Take a look to Laratrust Package and invest some time reading how to use the package. There is also a basic example of how to use it with this package:

Also, you can search on the closed issues.