public function getPermissions($name)
    {
        $route = $this->router->getRoutes()->getByName($name);

        // If route not exists, return NULL
        if ($route === null) {
            return null;
        }

        $permissions = [];

        // Get permission from permission middleware
        foreach ($route->middleware() as $middleware) {
            if (strpos($middleware, 'permission:') === 0) {
                list(, $permission) = explode(':', $middleware, 2);
                $permissions[] = $permission;
            }
        }

        // Get permissions from array syntax
        $action = $route->getAction();

        if (array_key_exists('permission', $action)) {
            $permissions[] = $action['permission'];
        }

        if (array_key_exists('permissions', $action)) {
            $permissions = array_merge($permissions, $action['permissions']);
        }

        return array_unique($permissions);
    }