public function getMiddlewareOrFallback(string $name, $middleMan, $result = null)
    {
        // asserts instead of type-hints because this is a trait and another trait uses it.
        assert($middleMan instanceof MiddlewareDispatcher);

        if (! $middleMan->groupIsEmpty('getters')) {
            $result = $middleMan->callGetters($name, $result);
        } elseif (is_object($result)) {
            $result = $result->$name;
        } else {
            $result = $this->getVisibleAttribute($name);
        }
        return $result;
    }