/**
  * @author WN
  * @param string $externalId
  * @param Collection $installations
  * @return bool
  */
 private function isNewInstallation($externalId, Collection $installations)
 {
     $item = $installations->search(function ($item) use($externalId, $installations) {
         if ($item->ext_id == $externalId) {
             return true;
         }
         return false;
     });
     if ($item !== false) {
         $installations->forget($item);
         return false;
     }
     return true;
 }
Example #2
0
 /**
  * Find and add the linked comment to the collection.
  * 
  * @param  int        $id
  * @param  Collection $comments
  * @return void
  */
 protected function findLinkedComment($id, Collection $comments)
 {
     $parent = $this->repository->findParent($id);
     if (!$parent || $parent->status != 'approved') {
         return $comments;
     }
     foreach ($comments as $key => $comment) {
         if ((int) $comment->id === (int) $parent->id) {
             $comments->forget($key);
         }
     }
     $comments->prepend($parent);
 }