diff --git a/README.md b/README.md index 45b73ae..44a7146 100644 --- a/README.md +++ b/README.md @@ -56,17 +56,18 @@ First, create a new notification or use an existing one : php artisan make:notification BMailNotification ``` -Next, add a public field '$id' to your class, which will be initialized in the constructor : +Next, add a public field '$template_id' to your class, which will be initialized in the constructor : ```bash -public $id; +public $template_id; /** - * @param Integer $id + * BMailNotification constructor. + * @param string $template_id */ -public function __construct(Integer $id) +public function __construct(string $template_id) { - $this->id = $id; + $this->template_id = $template_id; } ``` @@ -81,7 +82,7 @@ Then, create a 'toTemplate()' method, in which you specify your template fields ```bash public function toTemplate($notifiable) { - return (new BMailTemplate($this->id)) + return (new BMailTemplate($this->template_id)) ->sender("john.doe@gmail.com", "John OPTIONNAL") OPTIONNAL ->replyTo("jean.grey@gmail.com", "Jean OPTIONNAL") OPTIONNAL ->recipients([ @@ -101,7 +102,13 @@ public function toTemplate($notifiable) } ``` -Finally, from your controller, send a notification for a user : +Finally, get the template's id : + +```bash +Go to https://bluescale.email, Templates tab, click on the template you want to use and copy the template identifier. +``` + +And from your controller, send a notification for a user : ```bash User::find('user_id')->notify(new BMailNotification('template_id')); diff --git a/src/BMailTemplate.php b/src/BMailTemplate.php index 9ca6542..1bed43f 100644 --- a/src/BMailTemplate.php +++ b/src/BMailTemplate.php @@ -7,7 +7,7 @@ class BMailTemplate implements \JsonSerializable /** * The template for the message * - * @var integer + * @var string */ public $template; @@ -39,7 +39,7 @@ class BMailTemplate implements \JsonSerializable */ public $parameters = []; - public function __construct(int $template) + public function __construct(string $template) { $this->template = $template; }