src/JumpGate/Database/Traits/Collection/Chaining.php
public function chainingGetMethod($key)
    {
        $newCollection = new self();

        foreach ($this->items as $item) {
            // This item is a collection
            if ($item instanceof self) {
                foreach ($item as $subItem) {
                    $newCollection->put($newCollection->count(), $subItem->$key);
                }

                continue;
            }

            // The next item in the chain is a collection
            if (is_object($item) && ! $item instanceof self && $item->$key instanceof self) {
                foreach ($item->$key as $subItem) {
                    $newCollection->put($newCollection->count(), $subItem);
                }

                continue;
            }

            $newCollection->put($newCollection->count(), $item->$key);
        }

        return $newCollection;
    }
public function chainingGetMethod($key)
    {
        $newCollection = new self();

        foreach ($this->items as $item) {
            // This item is a collection
            if ($item instanceof self) {
                foreach ($item as $subItem) {
                    $newCollection->put($newCollection->count(), $subItem->$key);
                }

                continue;
            }

            // The next item in the chain is a collection
            if (is_object($item) && ! $item instanceof self && $item->$key instanceof self) {
                foreach ($item->$key as $subItem) {
                    $newCollection->put($newCollection->count(), $subItem);
                }

                continue;
            }

            $newCollection->put($newCollection->count(), $item->$key);
        }

        return $newCollection;
    }
public function chainingGetMethod ( $ key ) { $ newCollection = new self ( ) ; foreach ( $ this -> items as $ item ) { // This item is a collection if ( $ item instanceof self ) { foreach ( $ item as $ subItem ) { $ newCollection -> put ( $ newCollection -> count ( ) , $ subItem -> $ key ) ; } continue ; } // The next item in the chain is a collection if ( is_object ( $ item ) && ! $ item instanceof self && $ item -> $ key instanceof self ) { foreach ( $ item -> $ key as $ subItem ) { $ newCollection -> put ( $ newCollection -> count ( ) , $ subItem ) ; } continue ; } $ newCollection -> put ( $ newCollection -> count ( ) , $ item -> $ key ) ; } return $ newCollection ; }
Dynamically retrieve attributes on the model.

@param  string $key

@return mixed
Dynamically retrieve attributes on the model .