LaravelFCM\Message\Topics::build PHP Method

build() public method

Transform to array
public build ( ) : array | string
return array | string
    public function build()
    {
        $this->checkIfOneTopicExist();
        if ($this->hasOnlyOneTopic()) {
            foreach ($this->conditions[0] as $topic) {
                return '/topics/' . $topic;
            }
        }
        return ['condition' => $this->topicsForFcm($this->conditions)];
    }

Usage Example

Example #1
0
 /**
  * get Options transformed
  *
  * @return array
  */
 protected function getOptions()
 {
     $options = $this->options ? $this->options->toArray() : [];
     if ($this->topic && !$this->topic->hasOnlyOneTopic()) {
         $options = array_merge($options, $this->topic->build());
     }
     return $options;
 }
All Usage Examples Of LaravelFCM\Message\Topics::build