'Telegram', 'whatsapp' => 'WhatsApp', 'viber' => 'Viber', 'sms' => 'SMS', 'email' => 'Email', ]; protected $fillable = [ 'company_id', 'name', 'channel', 'subject', 'body', 'variables', 'is_active', ]; protected $casts = [ 'variables' => 'array', 'is_active' => 'boolean', ]; /** * Render template body with the given context, replacing {key} tokens. */ public function render(array $context = []): string { $body = $this->body; foreach ($context as $key => $val) { $body = str_replace('{' . $key . '}', (string) $val, $body); } return $body; } }