public function load_plugin_menu($package_name, $menu_data, bool $require_affiliation = false)
    {

        // Validate the package menu
        $this->validate_menu($package_name, $menu_data);

        // Check if the current user has the permission
        // required to see the menu
        if (isset($menu_data['permission'])) {

            // Check if the parameter is an array
            // in such case, we grant access if user has at least one permission
            if (is_array($menu_data['permission'])) {
                foreach ($menu_data['permission'] as $menu_permission)
                    if (auth()->user()->has($menu_permission, $require_affiliation))
                        return $menu_data;

                return null;
            }

            if (! auth()->user()->has($menu_data['permission'], $require_affiliation))
                return null;
        }

        return $menu_data;
    }
public function load_plugin_menu($package_name, $menu_data, bool $require_affiliation = false)
    {

        // Validate the package menu
        $this->validate_menu($package_name, $menu_data);

        // Check if the current user has the permission
        // required to see the menu
        if (isset($menu_data['permission'])) {

            // Check if the parameter is an array
            // in such case, we grant access if user has at least one permission
            if (is_array($menu_data['permission'])) {
                foreach ($menu_data['permission'] as $menu_permission)
                    if (auth()->user()->has($menu_permission, $require_affiliation))
                        return $menu_data;

                return null;
            }

            if (! auth()->user()->has($menu_data['permission'], $require_affiliation))
                return null;
        }

        return $menu_data;
    }
public function load_plugin_menu ( $ package_name , $ menu_data , bool $ require_affiliation = false ) { // Validate the package menu $ this -> validate_menu ( $ package_name , $ menu_data ) ; // Check if the current user has the permission // required to see the menu if ( isset ( $ menu_data [ 'permission' ] ) ) { // Check if the parameter is an array // in such case, we grant access if user has at least one permission if ( is_array ( $ menu_data [ 'permission' ] ) ) { foreach ( $ menu_data [ 'permission' ] as $ menu_permission ) if ( auth ( ) -> user ( ) -> has ( $ menu_permission , $ require_affiliation ) ) return $ menu_data ; return null ; } if ( ! auth ( ) -> user ( ) -> has ( $ menu_data [ 'permission' ] , $ require_affiliation ) ) return null ; } return $ menu_data ; }
Load menus from any registered plugins.

This may end up being quite a complex method, as we need
to validate a lot of the menu structure that is set
out.

Packages should register menu items in a config file,
loaded in a ServiceProvider's register() method in the
'package.sidebar' namespace. The structure of these
menus can be seen in the SeAT Wiki.

@param $package_name
@param $menu_data
@param $require_affiliation bool True if the menu is requiring affiliation

@return array
@throws \Seat\Web\Exceptions\PackageMenuBuilderException
Load menus from any registered plugins .