src/Collection.php
public function only($keys)
    {
        $keys = is_array($keys) ? $keys : func_get_args();

        return $this->filter(function ($value, $key) use ($keys) {
            return in_array($key, $keys, true);
        });
    }
public function only($keys)
    {
        $keys = is_array($keys) ? $keys : func_get_args();

        return $this->filter(function ($value, $key) use ($keys) {
            return in_array($key, $keys, true);
        });
    }
public function only ( $ keys ) { $ keys = is_array ( $ keys ) ? $ keys : func_get_args ( ) ; return $ this -> filter ( function ( $ value , $ key ) use ( $ keys ) { return in_array ( $ key , $ keys , true ) ; } ) ; }
Returns a new collection containing only these keys

@param mixed $keys Array of key names, or multiple arguments

@return Collection
Returns a new collection containing only these keys