public function isAllowed(Authenticatable $user = null): bool
    {
        $user = $user ?: Auth::user();

        foreach ($this->authorizationStack as $auth) {
            if (is_callable($auth)) {
                if (!$auth($user)) {
                    return false;
                }
            } elseif ($user && $user->cannot($auth)) {
                return false;
            }
        }

        return true;
    }
public function isAllowed(Authenticatable $user = null): bool
    {
        $user = $user ?: Auth::user();

        foreach ($this->authorizationStack as $auth) {
            if (is_callable($auth)) {
                if (!$auth($user)) {
                    return false;
                }
            } elseif ($user && $user->cannot($auth)) {
                return false;
            }
        }

        return true;
    }
public function isAllowed ( Authenticatable $ user = null ) : bool { $ user = $ user ? : Auth :: user ( ) ; foreach ( $ this -> authorizationStack as $ auth ) { if ( is_callable ( $ auth ) ) { if ( ! $ auth ( $ user ) ) { return false ; } } elseif ( $ user && $ user -> cannot ( $ auth ) ) { return false ; } } return true ; }
Returns whether the menu item is allowed for the user

@param Authenticatable $user In case no user is passed Auth::user() will be used

@return bool
Returns whether the menu item is allowed for the user