-1

in my notifications i use the (MailMessage)->markdown('<file>') syntax and it works.

Not, i want to "inject" the markdown from outside, so i need something like this

(MailMessage)->markdown("<string">);

I think, you get the point.

When i now just give my markdown as a string to this function, it will not work and throws a

No hint path defined for [# Headline

Next line

error message.

So, how can i use string templates in my MailMessage markdown notifications?

Paladin
  • 1,637
  • 13
  • 28

1 Answers1

1

I'm not entirely sure why you'd want to put your markdown into a string as this is a bit counter-intuitive. The markdown method can only be used to specify the template path via dot notation - there is no current way to inject a markdown string.

However, what you could do is create a template that simply outputs whatever you pass to it (ie: the message/vars). For example:

(MailMessage)->markdown('my.markdown.template', ['data' => "my string here with markdown and whatnot"]);

Then, in your my.markdown.template, simply echo the data with nothing else: {{ $data }}

Rob W
  • 9,134
  • 1
  • 30
  • 50
  • Thanks for your answer. The goal is to get a dynamic system of templates for emails. I want the customer to be able to store a template in the db and then fetch this template, parse the variables in it and email this template. Am i on the wrong track to do this with markdown() ??? – Paladin Sep 24 '18 at 06:48