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
Livewire throws error when passing EloquentCollection that does NOT contain objects #1980
Comments
@nuernbergerA pointed out that it seems this is more a Laravel issue than a Livewire issue since serialization on the Laravel side is leading to this error. |
Will open a PR soon |
Should be fixed with the next Laravel release. |
👋 Oh Hi! I'm Squishy, the friendly jellyfish that manages Livewire issues. I see this issue has been closed. Here in the Livewire repo, we have an "issues can be closed guilt-free and without explanation" policy. If for ANY reason you think this issue hasn't been resolved, PLEASE feel empowered to re-open it. Re-opening actually helps us track which issues are a priority. Reply "REOPEN" to this comment and we'll happily re-open it for you! (More info on this philosophy here: https://twitter.com/calebporzio/status/1321864801295978497) |
This issue still exists and not fixed yet |
|
Description
If you pass to your Livewire component an
EloquentCollection
whichdoes not hold objects
, Livewire will throw an Exception likeget_class() expects parameter 1 to be object, ...(other type) given
.In our case, we were receiving data from the DB and we transformed it.
We could easily quick-dirty-fix it by transforming it into a
default collection
.I assume Livewire is handling EloquentCollections differently which causes this issue.
Exact steps to reproduce
I have created a LaravelPlayground setup to demo the issue in a simple way: https://laravelplayground.com/#/snippets/f8ac92e0-6abc-4452-9521-35795a225723
Stripped-down, copy-pastable code snippets
See LaravelPlayground example.
Context
The text was updated successfully, but these errors were encountered: