'''function sendNotification($token,$dataArr) {
$key = env('FCM_KEY','');
$fcmApiKey = $key;
$url = 'https://fcm.googleapis.com/fcm/send';
$registrationIds = $token;//Fcm Device ids array
$message = $dataArr['message'];
$title = $dataArr['title'];
$image=$dataArr['image'];
$news_id=$dataArr['station_id'];
$random=$dataArr['random_id'];
$msg = array('message' => $message,'title' => $title,"image"=>$image,"station_id"=>$news_id,"random_id"=>$random);
$fields = array('registration_ids' => $registrationIds,'data' => $msg);
$headers = array(
'Authorization: key=' . $fcmApiKey,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, $url );
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
$result = curl_exec($ch );
// Execute post
$result = curl_exec($ch);
if ($result === FALSE) {
die('Curl failed: ' . curl_error($ch));
}
// Close connection
curl_close($ch);
return $result;
}'''