first commit

This commit is contained in:
vedant-chavan
2024-06-12 20:29:05 +05:30
commit eff0228447
246 changed files with 25388 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Http\Controllers\API;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class CreateNotificationOneSignalController extends Controller
{
function createNotification(Request $request) {
$player_id = $request->player_id;
$heading = $request->heading;
$message = $request->content;
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://onesignal.com/api/v1/notifications?app_id=1be4b99b-8faa-45b8-ad82-c66225d77bf4', [
'body' => '{"include_player_ids":["'.$player_id.'"],"headings":{"en":"'.$heading.'"},"contents":{"en":"'.$message.'"},"name":"INTERNAL_CAMPAIGN_NAME"}',
'headers' => [
'Authorization' => 'Basic MWM2NGEyODUtN2U5MS00MzlkLWJhYmItZGUyODRjYTlmNGJm',
'accept' => 'application/json',
'content-type' => 'application/json',
],
]);
$resBody = $response->getBody();
return $resBody;
}
}