[ Root System Explorer ]
Location:
Root
/
var
/
www
/
html
/
app.acma.in
/
app
/
Helpers
+ Folder
+ File
Upload
Editing: SendNotification.php
<?php namespace App\Helpers; use FCM; use LaravelFCM\Message\OptionsBuilder; use LaravelFCM\Message\PayloadDataBuilder; use LaravelFCM\Message\PayloadNotificationBuilder; use LaravelFCM\Message\Topics; use App\Http\Controllers\API\NotificationController; use App\Notification; use Carbon\Carbon; class SendNotification { public static function send_notification_fcm($title, $message, $fcm_id, $type){ $url = 'https://fcm.googleapis.com/fcm/send'; $now = Carbon::now(); $date = strtotime($now); $fields = array ( 'to' => $fcm_id, 'data' => array ( "message" => $message, "title" => $title, "type" => $type ) ); $fields = json_encode ( $fields ); $headers = array ( 'Authorization: key=' . "AAAAvNS5Cho:APA91bE5AYwB5Z3QRFZnUVlzyhddVM_ExvWLmSXld0lvLXBQ-F5vTTJk1d4UEkumiJpp_fMvo8ZAOXvq2EKggWuNCJLjebBMVIRjb7I8aepsBE14ds40PYiPhswJIT3bkwIFrDsdT1No", '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_POSTFIELDS, $fields ); $noti=new Notification; $noti->text=$message; $noti->title=$title; $noti->fcm_id=$fcm_id; $noti->created_at=Carbon::now(); $noti->updated_at=Carbon::now(); $noti->save(); $result = curl_exec ( $ch ); curl_close ( $ch ); } }
SAVE CHANGES
[ CANCEL ]
Name
Type
Actions
.. (Parent Directory)
📄 SendNotification.php
FILE
Ren
[EDIT]
DEL