protected function relationshipsToArray(): array
    {
        $relationships = [];

        foreach ($this->relationships as $name => $relationship)
        {
            $relationships[$name] = $relationship->toArray();
        }

        return $relationships;
    }
protected function relationshipsToArray(): array
    {
        $relationships = [];

        foreach ($this->relationships as $name => $relationship)
        {
            $relationships[$name] = $relationship->toArray();
        }

        return $relationships;
    }
protected function relationshipsToArray ( ) : array { $ relationships = [ ] ; foreach ( $ this -> relationships as $ name => $ relationship ) { $ relationships [ $ name ] = $ relationship -> toArray ( ) ; } return $ relationships ; }
Cast relationships to an array

@return array
Cast relationships to an array