I have a table where I want to show the data from a collection and the count of an hasmany relationship. I want to use the Laravel withcount way so that I won't load too many models. The query looks like this: Company::withCount('transactions');
Query works fine and adds the transactions_count to the collection.
On the first render it's also shown in de blade. But when Livewire makes a roundtrip that field/data gets lost. I guess it's not being send from Livewire to the backend. Of course I could load all the models and count them in php, but I would rather not.
What can I do that this additional field is not lost?