Skip to content

Commit

Permalink
Add method fromRaw.
Browse files Browse the repository at this point in the history
  • Loading branch information
gentritabazi committed Feb 21, 2021
1 parent 2006d94 commit 7a37a67
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Services/Larafirebase.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class Larafirebase

private $fromArray;

private $fromRaw;

const API_URI = 'https://fcm.googleapis.com/fcm/send';

public function withTitle($title)
Expand Down Expand Up @@ -64,6 +66,13 @@ public function fromArray($fromArray)
return $this;
}

public function fromRaw($fromRaw)
{
$this->fromRaw = $fromRaw;

return $this;
}

public function sendNotification($tokens)
{
$fields = array(
Expand Down Expand Up @@ -95,6 +104,11 @@ public function sendMessage($tokens)
return $this->callApi($fields);
}

public function send()
{
return $this->callApi($this->fromRaw);
}

public function callApi($fields)
{
$response = Http::withHeaders([
Expand Down

0 comments on commit 7a37a67

Please sign in to comment.