File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ class Fcm
12
12
protected $ topic ;
13
13
protected $ data ;
14
14
protected $ notification ;
15
+ protected $ timeToLive ;
15
16
16
17
public function to (array $ recipients )
17
18
{
@@ -40,6 +41,13 @@ public function notification(array $notification = [])
40
41
41
42
return $ this ;
42
43
}
44
+
45
+ public function timeToLive (int $ timeToLive )
46
+ {
47
+ $ this ->timeToLive = $ timeToLive ;
48
+
49
+ return $ this ;
50
+ }
43
51
44
52
public function send ()
45
53
{
@@ -57,6 +65,10 @@ public function send()
57
65
} else {
58
66
$ payloads ['registration_ids ' ] = $ this ->recipients ;
59
67
}
68
+
69
+ if ($ this ->timeToLive !== null && $ this ->timeToLive >= 0 ) {
70
+ $ payloads ['time_to_live ' ] = (int ) $ this ->timeToLive ;
71
+ }
60
72
61
73
$ serverKey = config ('laravel-fcm.server_key ' );
62
74
You can’t perform that action at this time.
0 commit comments