-
I try to pass relationship datas to a mailable, but datas are not in the Mailable build. domaine hasMany actualite. The Controller
The Mailable
The repository
For the domaines datas : When i do a dd() in the repository, it's OK, i have the expected datas with relationship and eagerload. I've tried this in the mailable :
Why, in the mailable, $this->domaines from the __construct is not available with the expected datas in the build ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
It may have something to do with serializing models. It may not be able to detect the type. Try add typehinting to your $domaines property. |
Beta Was this translation helpful? Give feedback.
-
You're right, it has something to do with serializing models It's about queue, relationship and (de)serialization. In Laravel doc : https://laravel.com/docs/9.x/queues#handling-relationships
For me, i've relationship in controller --> mail queue --> serialization --> job handle --> deserialization --> mailable build the constrain's relationship in controller must be re-constrain in the mailable build |
Beta Was this translation helpful? Give feedback.
You're right, it has something to do with serializing models
It's about queue, relationship and (de)serialization.
In Laravel doc : https://laravel.com/docs/9.x/queues#handling-relationships
For me, i've
relationship in controller --> mail queue --> serialization --> job handle --> deserialization --> mailable build
the constrain's relationship in controller must be re-constrain in the m…