first commit
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user