protected function filterItemPermissions($user, array $items)
    {
        if (!$user) {
            return $items;
        }

        $items = array_filter($items, function ($item) use ($user) {
            if (!$item->permissions || !count($item->permissions)) {
                return true;
            }

            return $user->hasAnyAccess($item->permissions);
        });

        return $items;
    }
protected function filterItemPermissions($user, array $items)
    {
        if (!$user) {
            return $items;
        }

        $items = array_filter($items, function ($item) use ($user) {
            if (!$item->permissions || !count($item->permissions)) {
                return true;
            }

            return $user->hasAnyAccess($item->permissions);
        });

        return $items;
    }
protected function filterItemPermissions ( $ user , array $ items ) { if ( ! $ user ) { return $ items ; } $ items = array_filter ( $ items , function ( $ item ) use ( $ user ) { if ( ! $ item -> permissions || ! count ( $ item -> permissions ) ) { return true ; } return $ user -> hasAnyAccess ( $ item -> permissions ) ; } ) ; return $ items ; }
Removes menu items from an array if the supplied user lacks permission.
@param User $user A user object
@param array $items A collection of menu items
@return array The filtered menu items
Removes menu items from an array if the supplied user lacks permission .