-
Notifications
You must be signed in to change notification settings - Fork 11k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG][5.6] undefined relationship [pivot] on model [App\Models\User] when broadcasting - sync queue #23068
Comments
Yes same issue here, I have removed SerializesModels since i am not queing only broadcasting and everything is back to normal. |
We can't find the bug looking at your entire code base, please include simple steps to replicate the issue. |
Same issue here... This a Illuminate\Contracts\Database\ModelIdentifier {#951
+class: "App\Models\User"
+id: 2
+relations: array:3 [
0 => "tenant"
1 => "roles"
2 => "roles.pivot"
]
+connection: "system"
} It tries to load the nested pivot relation from the role relation, although this is an automatic relation set by Laravel when using a I don't know if it is better to filter the pivot related relation from the `ModelIdentifier' object when serializing, or to check if a relation is explicitly defined in the model when restoring from that object... I'll try to figure out and work out a fix to this, but in the meantime I'm holding on upgrading my production app to 5.6 |
Steps to reproduce:
|
I submitted PR #23081 to try to fix this issue |
Hi, This is my first message on Stackoverflow, so please let me know if I miss stating any required information. I just updated my Laravel app to version 5.6(.21) from 5.5.* and still have the same problem that the pivot relations are loaded when serializing the models for a job. So all my notification jobs break as the notifiable is a user with many settings containing a pivot relation to check what notifications to send (email, database, etc.). Seeing this card I believe this should've been fixed already? Best, Jorrit. |
I still have the same issue even if the queue driver is |
Are you guys sure that this bug doesn't exist anymore in the latest Laravel version? I still have this problem and already opened a discussion at Laracasts, but nobody could find a solution: https://laracasts.com/discuss/channels/laravel/call-to-undefined-relationship-pivot-on-model-appmodelsuser-when-using-queues |
I am also seeing this issue on an application I am attempting to uplift from 5.5 to 5.6. |
I am also experiencing the same issue when upgrading from 5.5 to 5.6 As a workaround I'm calling |
I've opened a PR where I've identified the problem. This should resolve the issues that we're having here. |
Description:
I just updated my Laravel version to 5.6 and updated the files from github.
Then running my tests I started getting the mentioned error on all the tests that broadcast. So I'm holding up on updating my production code.
Stack trace:
Steps To Reproduce:
The text was updated successfully, but these errors were encountered: