/**
  * Execute the console command.
  *
  * @param Client $client
  *
  * @return mixed
  */
 public function handle(Client $client)
 {
     try {
         // Get packages from packagist
         $packages = $client->request('GET', $this->packagesUrl);
     } catch (\Exception $e) {
         $this->error($e->getMessage());
         return false;
     }
     // Validate JSON
     $packages = json_decode($packages->getBody()->getContents(), true);
     if (json_last_error() > 0 || !isset($packages['packageNames'])) {
         $this->error('Unfortunately the packages could not be fetched. Please try again later.');
         return false;
     }
     $packages = $packages['packageNames'];
     foreach ($packages as $package) {
         Package::firstOrCreate(['name' => $package]);
     }
 }