From a59eca7dc41f46f02762adfef20d092614430c50 Mon Sep 17 00:00:00 2001 From: Loann Meignant Date: Tue, 14 Apr 2020 17:24:54 +0200 Subject: [PATCH] Creating BMailChannel --- README.md | 2 +- src/BMailApi.php | 5 +++++ src/Broadcasting/BMailChannel.php | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/Broadcasting/BMailChannel.php diff --git a/README.md b/README.md index 149f8c3..0ac66e8 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ $template = (new BMailTemplate("** template_id **")) ] ]) ->addRecipient("edward@gmail.com") - ->parameters(["key1" => "value1", "key2" => "value2"]) + ->parameters(["key" => "value", "key" => "value"]) ->addParameter("key", "value"); ``` diff --git a/src/BMailApi.php b/src/BMailApi.php index 58547d0..1a681d4 100644 --- a/src/BMailApi.php +++ b/src/BMailApi.php @@ -20,6 +20,11 @@ class BMailApi $this->api_key = $api_key; } + /** + * @param $template + * @return \Psr\Http\Message\StreamInterface + * @throws BMailException + */ public function send($template) { $url = config('bmail.api_url'); diff --git a/src/Broadcasting/BMailChannel.php b/src/Broadcasting/BMailChannel.php new file mode 100644 index 0000000..a2dfb09 --- /dev/null +++ b/src/Broadcasting/BMailChannel.php @@ -0,0 +1,17 @@ +toTemplate($notifiable); + + return (new BMailApi(config("bmail.api_key")))->send($template); + } +}