Skip to content

Latest commit

 

History

History
134 lines (66 loc) · 2.29 KB

LaravelFCM-Message-Topics.md

File metadata and controls

134 lines (66 loc) · 2.29 KB

LaravelFCM\Message\Topics

Class Topics

Create topic or a topic condition

  • Class name: Topics
  • Namespace: LaravelFCM\Message

Methods

topic

\LaravelFCM\Message\Topics LaravelFCM\Message\Topics::topic(string $first)

Add a topic, this method should be called before any conditional topic

  • Visibility: public

Arguments

  • $first string - <p>topicName</p>

orTopic

\LaravelFCM\Message\Topics LaravelFCM\Message\Topics::orTopic(string|\Closure $first)

Add a or condition to the precedent topic set

Parenthesis is a closure

Equivalent of this: 'TopicA' in topic' || 'TopicB' in topics

         $topic = new Topics();
         $topic->topic('TopicA')
               ->orTopic('TopicB');

Equivalent of this: 'TopicA' in topics && ('TopicB' in topics || 'TopicC' in topics)

         $topic = new Topics();
         $topic->topic('TopicA')
               ->andTopic(function($condition) {
                     $condition->topic('TopicB')->orTopic('TopicC');
         });

Note: Only two operators per expression are supported by fcm

  • Visibility: public

Arguments

  • $first string|Closure - <p>topicName or closure</p>

andTopic

\LaravelFCM\Message\Topics LaravelFCM\Message\Topics::andTopic(string|\Closure $first)

Add a and condition to the precedent topic set

Parenthesis is a closure

Equivalent of this: 'TopicA' in topic' && 'TopicB' in topics

         $topic = new Topics();
         $topic->topic('TopicA')
               ->anTopic('TopicB');

Equivalent of this: 'TopicA' in topics || ('TopicB' in topics && 'TopicC' in topics)

         $topic = new Topics();
         $topic->topic('TopicA')
               ->orTopic(function($condition) {
                     $condition->topic('TopicB')->AndTopic('TopicC');
         });

Note: Only two operators per expression are supported by fcm

  • Visibility: public

Arguments

  • $first string|Closure - <p>topicName or closure</p>

build

array|string LaravelFCM\Message\Topics::build()

Transform to array

  • Visibility: public

hasOnlyOneTopic

boolean LaravelFCM\Message\Topics::hasOnlyOneTopic()

Check if only one topic was set

  • Visibility: public