src/Console/Add.php
public function askPackageKey($summary, $message = 'Please provide an id')
    {
        $this->table(['id', 'name'], $summary);

        $selected = $this->ask($message);

        $key = collect($summary)->pluck('id')->search($selected);

        if ($key === false) {
            $this->warn('Invalid package name or id given.');

            return $this->askPackageKey($summary, 'Please provide a valid id');
        }

        return $key;
    }
public function askPackageKey($summary, $message = 'Please provide an id')
    {
        $this->table(['id', 'name'], $summary);

        $selected = $this->ask($message);

        $key = collect($summary)->pluck('id')->search($selected);

        if ($key === false) {
            $this->warn('Invalid package name or id given.');

            return $this->askPackageKey($summary, 'Please provide a valid id');
        }

        return $key;
    }
Ask user for package key.

@param        $summary
@param string $message

@return mixed