Mail problem rendering view with data with two arrays
Hello. I have a row action which lets users send email with attached Pdf with some info about the record. Everything works fine.
Now I want the user can change subject and body of the email and I have included a form and user can type.
And it works fine till then. I launch the mail with the data:
The view can manage $expediente->whateverfield correctly but $data is undefined.
Any ideas, please?
Solution:Jump to solution
I solved it!!!
Looking at the official info from Laravel:
https://laravel.com/docs/11.x/mail#configuring-the-view
...
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
1 Reply
Solution
I solved it!!!
Looking at the official info from Laravel:
https://laravel.com/docs/11.x/mail#configuring-the-view
I don't have to pass the data in the ->content(...)
It has to be added to the content function itself:
The with: is the solution to add extra data apart from the Expediente resource data.
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.