Beispiel #1
0
 /**
  * Tag a node
  *
  * @param $tag
  */
 public function taggedAs($tag)
 {
     if (empty($this->current_node)) {
         return;
     }
     $this->current_node->tags = $tag;
     $this->current_node->save();
 }
Beispiel #2
0
 /**
  * Response for intended actions
  *
  * @return bool
  */
 private function responseIntendedAction()
 {
     $waiting = $this->storage->get($this->getLeadId(), '_wait');
     // We set previous_waiting to back to support $bot->keep() method
     $this->conversation->set('previous_intended_action', $waiting);
     if (!empty($waiting)) {
         $this->storage->set($this->getLeadId(), '_wait', false);
         // Get Nodes for intended actions.
         if (is_numeric($waiting)) {
             $nodes = Node::find($waiting);
             if (!empty($nodes)) {
                 $nodes = [$nodes];
             }
         } else {
             $nodes = Node::findByTypeAndPattern('intended', $waiting);
         }
         $this->response($nodes);
         return true;
     }
     return false;
 }
Beispiel #3
0
 private function removeNodeById($id)
 {
     Node::destroy($id);
 }