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
1212 protected $ topic ;
1313 protected $ data ;
1414 protected $ notification ;
15+ protected $ timeToLive = null ;
1516
1617 public function to (array $ recipients )
1718 {
@@ -40,6 +41,13 @@ public function notification(array $notification = [])
4041
4142 return $ this ;
4243 }
44+
45+ public function timeToLive (int $ timeToLive )
46+ {
47+ $ this ->timeToLive = $ timeToLive ;
48+
49+ return $ this ;
50+ }
4351
4452 public function send ()
4553 {
@@ -57,6 +65,10 @@ public function send()
5765 } else {
5866 $ payloads ['registration_ids ' ] = $ this ->recipients ;
5967 }
68+
69+ if ($ this ->timeToLive !== null && $ this ->timeToLive >= 0 ) {
70+ $ payloads ['time_to_live ' ] = (int ) $ this ->timeToLive ;
71+ }
6072
6173 $ serverKey = config ('laravel-fcm.server_key ' );
6274
You can’t perform that action at this time.
0 commit comments