/**
  * Execute the console command.
  */
 public function fire()
 {
     $contracts = $this->contract->all();
     foreach ($contracts as $contract) {
         if ($contract->metadata_status == "published") {
             $this->elastic->postMetadata($contract->id);
             $this->info(sprintf('Contract %s : Metadata Indexed.', $contract->id));
         }
         if ($contract->text_status == "published") {
             $this->elastic->postText($contract->id);
             $this->info(sprintf('Contract %s : Text Indexed.', $contract->id));
         }
         if ($this->annotations->getStatus($contract->id) == "published") {
             $this->elastic->postAnnotation($contract->id);
             $this->info(sprintf('Contract %s : Annotations Indexed.', $contract->id));
         }
     }
 }
 /**
  * Seed Admin User with Roles
  */
 public function run()
 {
     $contracts = Contract::all();
     foreach ($contracts as $contract) {
         $metadata = $contract->metadata;
         $licenseName = $metadata->license_name;
         $licenseIdentifier = $metadata->license_identifier;
         unset($metadata->license_name);
         unset($metadata->license_identifier);
         $metadata->concession = [["license_name" => $licenseName, "license_identifier" => $licenseIdentifier]];
         $contract->metadata = $metadata;
         $contract->save();
     }
 }
 /**
  * Execute the console command.
  */
 public function fire()
 {
     $contracts = Contract::all();
     foreach ($contracts as $key => $contract) {
         $contractDir = $contract->id;
         if ($this->storage->disk('s3')->exists("{$contractDir}/{$contract->file}")) {
             try {
                 if ($this->renameS3ContractFileName($contract)) {
                     $this->contract->updateFileName($contract);
                     $this->info("done moving {$contractDir}/{$contract->file}");
                 }
             } catch (\Exception $e) {
                 $message = $e->getMessage();
                 $this->error("error moving {$contractDir}/{$contract->file}:{$message}");
             }
         } else {
             $this->error("{$contractDir}/{$contract->file} file does not exists");
         }
     }
     $this->call('nrgi:bulkindex');
 }
 /**
  * Get Contract List
  * @return mixed
  */
 public function getList()
 {
     return $this->contract->all();
 }