src/MultilevelCollection.php
public function has(string $key): bool
    {
        $slug = $this->splitKey($key);

        if (is_string($slug)) {
            return isset($this[$slug]);
        }

        $collection = $this->all();

        foreach ($this->splitKey($key) as $search) {
            if (!isset($collection[$search])) {
                return false;
            }

            $collection = $collection[$search];
        }

        return true;
    }
public function has(string $key): bool
    {
        $slug = $this->splitKey($key);

        if (is_string($slug)) {
            return isset($this[$slug]);
        }

        $collection = $this->all();

        foreach ($this->splitKey($key) as $search) {
            if (!isset($collection[$search])) {
                return false;
            }

            $collection = $collection[$search];
        }

        return true;
    }
public function has ( string $ key ) : bool { $ slug = $ this -> splitKey ( $ key ) ; if ( is_string ( $ slug ) ) { return isset ( $ this [ $ slug ] ) ; } $ collection = $ this -> all ( ) ; foreach ( $ this -> splitKey ( $ key ) as $ search ) { if ( ! isset ( $ collection [ $ search ] ) ) { return false ; } $ collection = $ collection [ $ search ] ; } return true ; }
Whether an item is present it the collection

@param string $key The item's key

@return bool
Whether an item is present it the collection