コード例 #1
0
 /**
  * Get all the contracts.
  *
  * @param array $ids
  * @param bool  $limit
  * @return Collection
  */
 public function getContract($ids, $limit)
 {
     if ($limit) {
         return $this->contract->whereIn('id', $ids)->paginate($limit);
     }
     return $this->contract->whereIn('id', $ids)->get();
 }
コード例 #2
0
 /**
  * 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));
         }
     }
 }
コード例 #3
0
 /**
  * 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();
     }
 }
コード例 #4
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $this->info('processing contract document');
     $contractId = $this->input->getArgument('contract_id');
     try {
         $contract = $this->contract->find($contractId);
         if ($this->input->getOption('force')) {
             $this->contract->moveS3File(sprintf('%s/%s', $contract->id, $contract->file), $contract->file);
             $contract->pages()->delete();
             $contract->pdf_process_status = Contract::PROCESSING_PIPELINE;
             $contract->save();
         }
         if ($this->process->execute($contractId)) {
             $this->info('processing completed.');
         } else {
             $this->error('Error processing contract document.check log for detail');
         }
     } catch (ModelNotFoundException $exception) {
         $this->error('could cot find contract.' . $exception->getMessage());
     } catch (\Exception $exception) {
         $this->error('processing contract document.' . $exception->getMessage());
     }
 }
コード例 #5
0
 /**
  * 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');
 }
コード例 #6
0
 /**
  * Get Total Annotation status by type
  * @param $statusType
  * @return mixed
  */
 public function getStatusCountByType($statusType)
 {
     return $this->contract->distinct()->select('contracts.id', 'a.status')->from('contracts')->leftJoin('contract_annotations as a', function ($join) use($statusType) {
         $join->on('contracts.id', '=', 'a.contract_id')->where('a.status', '=', $statusType);
     })->get();
 }