Creating BMailChannel

This commit is contained in:
Loann 2020-04-14 17:24:54 +02:00
parent acf10e92b4
commit a59eca7dc4
3 changed files with 23 additions and 1 deletions

View File

@ -60,7 +60,7 @@ $template = (new BMailTemplate("** template_id **"))
] ]
]) ])
->addRecipient("edward@gmail.com") ->addRecipient("edward@gmail.com")
->parameters(["key1" => "value1", "key2" => "value2"]) ->parameters(["key" => "value", "key" => "value"])
->addParameter("key", "value"); ->addParameter("key", "value");
``` ```

View File

@ -20,6 +20,11 @@ class BMailApi
$this->api_key = $api_key; $this->api_key = $api_key;
} }
/**
* @param $template
* @return \Psr\Http\Message\StreamInterface
* @throws BMailException
*/
public function send($template) public function send($template)
{ {
$url = config('bmail.api_url'); $url = config('bmail.api_url');

View File

@ -0,0 +1,17 @@
<?php
namespace BMail;
use Illuminate\Notifications\Notification;
class BMailChannel
{
public function send($notifiable, Notification $notification)
{
$template = $notification->toTemplate($notifiable);
return (new BMailApi(config("bmail.api_key")))->send($template);
}
}