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;
    }
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;
    }
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 ; }
Gets the value of the given attribute through middleware or locally as a fallback.

@param string $name
@param $middleMan
@param mixed $result
@return mixed|null
Gets the value of the given attribute through middleware or locally as a fallback .