Skip to content

Commit

Permalink
Add default headings app name
Browse files Browse the repository at this point in the history
  • Loading branch information
faytekin committed Feb 28, 2022
1 parent 21bb8ba commit cfbf223
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/OneSignalChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public function send($notifiable, Notification $notification): ?object
->asJson()->acceptJson()
->post(self::ENDPOINT, [
'app_id' => $this->appId,
'contents' => $message->getBody(),
'headings' => $message->getHeadings(),
'contents' => $message->getBody(),
'data' => $message->getData(),
'include_player_ids' => is_array($userIds) ? $userIds : [$userIds],
]);
Expand Down
8 changes: 6 additions & 2 deletions src/OneSignalMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ public static function create($body = ''): self
return new static($body);
}

/**
* @param string|array $body
*/
public function __construct($body = '')
{
$this->setBody($body);
$this->setSubject(config('app.name'));
}

protected function arrayValue($value): array
Expand All @@ -28,7 +32,7 @@ protected function arrayValue($value): array
/**
* Set the message body.
*
* @param mixed $value
* @param string|array $value
*
* @return $this
*/
Expand All @@ -42,7 +46,7 @@ public function setBody($value): self
/**
* Set the message subject.
*
* @param mixed $value
* @param string|array $value
*
* @return $this
*/
Expand Down
3 changes: 1 addition & 2 deletions src/OneSignalServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class OneSignalServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
* @noinspection PhpUndefinedFunctionInspection
* @throws \Exception
*/
public function boot()
Expand All @@ -33,4 +32,4 @@ public function register()
{
//
}
}
}

0 comments on commit cfbf223

Please sign in to comment.