kirschbaum-development / nova-mail

A Laravel Nova action that provides a mail sending form for any resource
MIT License
72 stars 25 forks source link

get variables from model eloquent #60

Open joaquimpsoares opened 1 year ago

joaquimpsoares commented 1 year ago

It would be nice to be able to insert placeholders that are not columns, like an eloquent model.

joaquimpsoares commented 1 year ago

I've just managed to get what I wanted in src/mail/send.php changed the following line and added "with" to my eloquent relationship and it worked

return $this->markdown('nova-mail::' . $this->filename(), $this->model->with('listing')->first()->toArray());

In the markdown editor just added {{ $listing['name'] }}

Thank you and hope this helps.