Replies: 3 comments 2 replies
-
If anyone has this issue, my workaround was to load one model then the other: $envelope = Envelope::findOrFail($envelopeId);
if (! $envelope->state->equals(Draft::class)) {
// .. do something
}
$recipient = Recipient:findOrFail($recipientId);
if (! $recipient->state->equals(Queued::class)) {
// .. do something
} |
Beta Was this translation helpful? Give feedback.
-
Which version of the package is this? |
Beta Was this translation helpful? Give feedback.
-
I've managed to pin down the issue after looking into it further, it turned out be on my end. I thought it was related to a whereHas but it was actually because of a join. I left some of the tests in my project breaking so I could come back to it, the real problem happens when joining tables, when I don't specify from which table I want the columns. I use hybrid uuid, so in my code I have something like this: $recipient = Recipient::with('envelope')
->join('envelopes', 'envelopes.id', '=', 'recipients.envelope_id')
->where('envelopes.uuid', $envelopeUuid)
->where('recipients.uuid', $recipientUuid)
->firstOrFail(): // <-- the issue Both of these tables had the same column The fix: $recipient = Recipient::with('envelope')
->join('envelopes', 'envelopes.id', '=', 'recipients.envelope_id')
->where('envelopes.uuid', $envelopeUuid)
->where('recipients.uuid', $recipientUuid)
->firstOrFail('recipients.*'): // <-- select the columns |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! After some time of troubleshooting, I couldn't solve this issue where, when resolving a "belongsTo" relationship where the current model has state but also the parent has states too, for some reason, the "StateCaster" tries to lookup for the parent states within the current model state property. Example:
I got an envelope that has many recipients, the bug occurs when trying to fetch the recipient with the envelope:
Each model state is in a different directory:
When I try to load and use both like this for example:
It throws an error like this:

Beta Was this translation helpful? Give feedback.
All reactions