File tree Expand file tree Collapse file tree 1 file changed +22
-8
lines changed Expand file tree Collapse file tree 1 file changed +22
-8
lines changed Original file line number Diff line number Diff line change 11
11
12
12
class Notification extends Base {
13
13
14
- public function setNotification ($ title , $ message ) {
14
+ public function setNotification ($ title , $ message, $ data = null ) {
15
15
$ this -> validateCurrent ($ title , $ message );
16
- $ this -> setPayload (
17
- array ('notification ' => array (
18
- 'title ' => $ title ,
19
- 'body ' => $ message
20
- ))
21
- );
16
+ if (is_array ($ data ) && count ($ data )>0 ){
17
+ $ this -> setPayload (
18
+ array (
19
+ 'notification ' =>
20
+ array (
21
+ 'title ' => $ title ,
22
+ 'body ' => $ message
23
+ ),
24
+ 'data ' => $ data
25
+ )
26
+ );
27
+
28
+ } else {
29
+ $ this -> setPayload (
30
+ array ('notification ' => array (
31
+ 'title ' => $ title ,
32
+ 'body ' => $ message
33
+ ))
34
+ );
35
+ }
22
36
}
23
37
24
38
/**
@@ -28,4 +42,4 @@ public function setNotification($title, $message) {
28
42
public function __invoke () {
29
43
return parent ::__invoke ();
30
44
}
31
- }
45
+ }
You can’t perform that action at this time.
0 commit comments