Exemple #1
0
 public function addToLoanIndex(Loan $loan)
 {
     if (\App::environment("testing")) {
         return;
     }
     $loanIndex = $this->getLoanIndex();
     $loanType = $loanIndex->getType('loan');
     $data = array('id' => $loan->getId(), 'category' => $loan->getCategory()->getName(), 'categoryId' => $loan->getCategory()->getId(), 'countryId' => $loan->getBorrower()->getCountry()->getId(), 'country_code' => $loan->getBorrower()->getCountry()->getCountryCode(), 'summary' => $loan->getSummary(), 'proposal' => $loan->getProposal(), 'status' => $loan->getStatus(), 'created_at' => $loan->getCreatedAt()->getTimestamp(), 'amount_raised' => $loan->getAmountRaised());
     $loanDocument = new \Elastica\Document($loan->getId(), $data);
     $loanType->addDocument($loanDocument);
     $loanType->getIndex()->refresh();
 }